.Net Example: Class Inheritance

In the ATEasy DotNet Example, we have three classes:

DotNetClass1
DotNetClass2
DotNetClass3

Notice that DotNetClass3 is derived from DotNetClass2 and DotNetClass2 is derived from DotNetClass1:

 

Since all members of the class DotNetClass1 belong to DotNetClass2, with DotNetClass2 object, you can access all of the class DotNetClass1 members.

Since all members of the class DotNetClass1 and DotNetClass2 belong to DotNetClass3, with DotNetClass3 object, you can access all members of the class DotNetClass1 and DotNetClass2.

Suppose the base class has the same function, name and parameter - its numbers and types - being matched.  Then you need to qualify with the base class name - example is as follows:

cls3=new DotNetClass3()

! call DotNetClass3's overloaded method

if cls3.OverloadedMethod(0)<>"DotNetClass3.OverloadedMethod.INT"

TestStatus=FAIL

endif

DotNetClass1 has the exact same such overloaded  method - then use as follows:

if cls3.DotNetClass1.OverloadedMethod(0)<>"DotNetClass1.OverloadedMethod.INT"

TestStatus=FAIL

endif