I have a base class and derived class, the base class has two methods which are overridden in the derived class. Let's take the following scenario:
My base class
public class BaseClass
public Overridable function method1()
method2()
End Function
public Overridable function method2()
' Empty !!!
End Function
End class
My Derived class
public class DerivedClass
public Overrides function method1()
MyBase.method1()
End Function
public Overrides function method2()
' Some code !!
End Function
End class
Now I have created an instance of the derived class and call method1().
Dim obj as new DerivedClass()
obj.method1()
method1() in the derived calls method1() in the base, which calls method2 in the base. the strange thing to me that method2 in base, which is empty, called the method2 in the derived! ..
Can any one explain to me what is happening and how calling methods with inheritance done? and what concept was applied with this hierarchy ?