Code: Select all
class A108 {
static __Call(arg, *) {
MsgBox(type(this) ' has not method ' arg)
} }
A108.unk('Test')
a:= A108.new()
a.unk('Test') ;__Call not exist
Code: Select all
class A108 {
static __Call(arg, *) {
MsgBox(type(this) ' has not method ' arg)
} }
A108.unk('Test')
a:= A108.new()
a.unk('Test') ;__Call not exist
Code: Select all
class A108 {
static Fun(arg, p*) => MsgBox(type(this) ' was called with parameter ' arg)
Fun(arg,p*) => MsgBox(type(this) ' was called with parameter ' arg)
}
A108.fun('Test')
a:= A108.new()
a.fun('Test')
It mean that instance must "see" and "use" static methods and properties.https://lexikos.github.io/v2/docs/Objects.htm#Custom_Classes wrote:Since Objects are dynamic and prototype-based, each class consists of two parts:
* The class has a Prototype object, on which all instances of the class are based. All methods and properties that apply to a specific instance are contained by the prototype object. This includes all properties and methods which lack the static keyword.
* The class itself is an object, containing only static methods and properties. This includes all properties and methods with the static keyword, and all nested classes. These do not apply to a specific instance, and can be used by referring to the class itself by name.
HotKeyIt wrote: ↑29 Feb 2020, 13:45Is does not seems to be mentioned somewhere in docs, not sure if it was intended to support that.
But could be a nice feature since you can declare a static and non static function with same name:Code: Select all
class A108 { static Fun(arg, p*) => MsgBox(type(this) ' was called with parameter ' arg) Fun(arg,p*) => MsgBox(type(this) ' was called with parameter ' arg) } A108.fun('Test') a:= A108.new() a.fun('Test')
Code: Select all
class A108 {
static __Call(arg, p*) => MsgBox(type(this) ' has not method ' arg)
;__Call(arg, p*) => MsgBox(type(this) ' has not method ' arg)
__Call(arg, p*) => A108.__Call(arg, p*)
}
A108.fun('Test')
a:= A108.new()
a.fun('Test')
Users browsing this forum: No registered users and 44 guests