I'm facing a problem here, let's assume I have a parent class :
class ParentClass
{
public void MethodA()
{
//Do stuff
MethodB();
}
public void MethodB()
{
//Do stuff
}
}
A child class inheriting ParentClass and overriding MethodB() :
class ChildClass : ParentClass
{
public new void MethodB()
{
//Do stuff
}
}
Now, if I call MethodA() from a ChildClass object
public static void Main()
{
ChildClass childObject = new ChildClass();
childObject.MethodA();
}
How can I be sure that the MethodB() hat will be called will be the one from the child class?