Override Methods in C#
In C#, when we override methods we have to keep remember some important points. Assume there is a parent class called ClassA and it has a method called method(). If we are going to override that method in a subclass ClassB, we have to use virtual and override keywords properly in suitable places. virtual should be used with method() in parent class and override should be used with method() in sub class. If we do not use these keywords properly Overridden functionality is not working properly. namespace BasicLangEx { class ClassA { public virtual void method() { Console.WriteLine("Method A"); } } } namespace BasicLangEx { class ClassB : ClassA { ...