Hide parent method and call it via base keyword
using System; class Parent// ww w . j a va2s. com { public void ShowMe() { Console.WriteLine("I am inside the Parent method"); } } class Child : Parent { public void ShowMe() { Console.WriteLine("I am inside the Child method"); //base.ParentMethod(); } } class Program { static void Main(string[] args) { Child obChild = new Child(); obChild.ShowMe(); } }
The program was compiled and run.
You are receiving a warning message saying that your derived class method hides the inherited parent class method.
The base keyword can be used in either of the following scenarios:
Both static and non-static constructors and destructors are not inherited.