#2036 How to get this type in mixin?

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: A

brian 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 this to figure out the type.

Login or Signup to reply.