In C# I can use typeof() or better something like this: if(myObject is Int32){
}
Now look at this example, what i'm trying to do. Class A and C are normal, but inside B I want to do more. I want that B can handle or do things when the parent class is a typeof something.
Class A
Field child:B
Field test:String = "hello I am A"
Method New()
child = New B()
End
End
Class C
Field child:B
Field somethingElse:String = "hello I am C"
Method New()
child = New B()
End
Method Bla:Void()
print "hi"
End
End
Class B
Field parent:Object
Method New(Aparent:Object)
parent=Aparent
If parent is B
Print parent.test
Endif
If parent is C
Print parent.somethingElse
parent.Bla()
Endif
If parent == typeof(B)
Print parent.test
Endif
End
End
is this possible in monkey, or do I think wrong ?
|