Wondering what the difference is between the following:
Case 1: Base Class
public void DoIt();
Case 1: Inherited class
<
I had the same question and it's really confusing,
you should consider that override and new keywords working only with objects of type base class and value of derived class. In this case only you'll see the effect of override and new:
So if you have class A and B, B inherits from A, then you instantiate an object like this:
A a = new B();
Now on calling methods will take its state into consideration. Override: means that it extends the function of the method, then it uses the method in the derived class, whereas new tell the compiler to hide the method in the derived class and use the method in the base class instead. Here is a very good sight to that subject:
https://msdn.microsoft.com/EN-US/library/ms173153%28v=VS.140,d=hv.2%29.aspx?f=255&MSPPError=-2147217396