what is the use of virtual and override keywords?

 Posted by Rajni.Shekhar on 4/3/2012 | Category: C# Interview questions | Views: 2860 | Points: 40

When you override any function or any function is overridable then apply virtual keyword with that function in base class and in derived class add override keyword with that function.
Class parent{

public virtual void fun_overridable(){//some code here}

class child:parent{
public override void fun_overridable(){//some code here}

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response