what are the Hiding method in c sharp can it is possible to hide method without using Virtual Function
| It is possible to hide the base class method with the derived class without using Virtual in base class and Override keyword in subclass.there are some condition where we have to redefine any method in derived class same name in base class now question arise how can we hide the method anwer is simple and logical we use the modifier NEW which tell the compiler that derived class method "hides the base class method. There are some example:
Class baseclas |
|
| s
{
Public void display() {console.writeline("base method"); }} class derived : baseclass{ public new void display(){ console.writeline("dervied mthod");} }class test {public static void main() {derived d=new derivedclass(); d.display();} } | |
