Overriding is when you provide a new implementation of a method override method in a descendant class when that method is defined in the base class as virtual .
Hiding is when you provide a new implementation of a method in a descendant class, if that method is not defined as virtual in the base class, or when your new implementation does not specify override .
Concealment is very often bad; you should try not to, if you can avoid it at all. Hiding can cause unexpected events, since hidden methods are used only when calling a variable of the actual type that you defined, and not using a reference to the base class ... on the other hand, virtual methods that are overridden call the correct version of the method, even if it is called using a base class reference in a child class.
For example, consider these classes:
public class BaseClass { public virtual void Method1()
Call like this using an InheritedClass instance in the appropriate link:
InheritedClass inherited = new InheritedClass(); inherited.Method1(); inherited.Method2();
This returns what you expect; both methods say they use versions of InheritedClass.
Running the InheritedClass1 Method
Running the InheritedClass2 Method
This code creates an instance of the same InheritedClass, but stores it in a BaseClass link:
BaseClass baseRef = new InheritedClass(); baseRef.Method1(); baseRef.Method2();
Usually, in accordance with the principles of OOP, you should expect the same result as in the above example. But you will not get the same result:
Running the InheritedClass1 Method
Running the BaseClass2 Method
When you wrote the InheritedClass code, you probably needed all the calls to Method2() to run the code you wrote in it. This will usually be the way it works - if you are working with the virtual method that you redefined. But since you are using the new / hidden method, it instead invokes the version for the link you are using.
If this behavior is really what you need; there you go. But I would strongly suggest that if this is what you want, there might be a big architecture problem with the code.