mixin GetClass{
static Type myType(){
// how to write?
// return this.typeof
}
}
class A:GetClass{
}
echo(A.myType.name) // must write: A
brianMon 24 Sep 2012
I don't see how something like that could ever work. A static method doesn't by definition is never passed any instance, and without an instance how could you figure out the type?
You have to make the method non-static, and then you can use this to figure out the type.
Akcelisto Sun 23 Sep 2012
mixin GetClass{ static Type myType(){ // how to write? // return this.typeof } } class A:GetClass{ } echo(A.myType.name) // must write: Abrian Mon 24 Sep 2012
I don't see how something like that could ever work. A static method doesn't by definition is never passed any instance, and without an instance how could you figure out the type?
You have to make the method non-static, and then you can use
thisto figure out the type.