What does the keyword virtual mean in the method definition?

Answers were Sorted based on User's Feedback



What does the keyword virtual mean in the method definition?..

Answer / venu gopal

The method can be over-ridden.

Is This Answer Correct ?    16 Yes 2 No

What does the keyword virtual mean in the method definition?..

Answer / kiran

Even though the function in base class is declared with
virtual keyword, it is not compulsory that the derived
class must override it.
namespace TestNewOverride
{
class MyBaseClass
{
int a;
public virtual int doubleit()
{
return 2 * a;
}
public MyBaseClass()
{
a = 5;
}
}

class MyDerivedClass:MyBaseClass
{
public static void Main()
{

}
}
}

Is This Answer Correct ?    7 Yes 0 No

What does the keyword virtual mean in the method definition?..

Answer / praseetha sandeep

when you have a method defined in a class which you want
to allow to be implimented by inherited class you can use
virtual function

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Which is faster abstract class or interface in c#?

1 Answers  


Advantages of c# over vb.net?

3 Answers   HCL, Syntel,


Is c# front end or back end?

1 Answers  


What is a protected class c#?

1 Answers  


Explain deadlock?

1 Answers  


How do we achieve encapsulation in c#?

1 Answers  


How do you comment out code in c#?

1 Answers  


Does c# support multiple inheritance (mi)?

1 Answers  


What is xaml file in c#?

1 Answers  


Helo , Help Me , Help Me About : C# Windows Application - Network How To Manage IP Client's Accessiblity To The Internet Share concise Substitute , Minor ISA Server

1 Answers  


Why do we use anonymous method in c#?

1 Answers  


What is toint32 c#?

1 Answers  


Categories