Saturday, July 21, 2018

What is New, Virtual and Override keyWords


New Keywords:
It is used for Method hiding.

Method Hiding:
For hiding the base class method from derived class simply declare the derived class method with new keyword.

Virtual and overriding Keyboards.
Overriding the base class method in a derived class the base class method is used virtual keyword and derived class method is used override keyword.

Example: 

public class A{
public virtual void test(){

}
}
class B:A
{
public overide void test()
}





No comments:

Post a Comment