I have a question about the following code:
#REFLECTION_FILTER="untitled*"
Import reflection
Function Main()
Local baseClass:= GetClass("a")
Local classes:= GetClasses()
For Local c:Int = 0 to classes.Length()-1
If classes[c].ExtendsClass(baseClass)
Print( "Class: " + classes[c].Name() )
Local methods:= classes[c].GetMethods()
For Local m:Int = 0 to methods.Length()-1
Print( " Method: " + methods[m].Name() )
Next
Local fields:= classes[c].GetFields()
For Local f:Int = 0 to fields.Length()-1
Print( " Field: " + fields[f].Name() )
Next
End
Next
End
Class a
Field fa
Method ma()
End
End
Class b extends a
Field fb
Method mb()
End
End
When you run this code, you will see it will print information about class a AND class b.
My questions:
1- Why is it printing the information about class a? I am checking if the current class EXTENDS class a, which to me means I am not interested in class a, but only in classes which extends class a. 2- When querying class b: why am I not seeing the methods and fields defined in class a as well? They are a part of class b as well.
|