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

What is the difference between System.console.WriteLine() and System.console.Write() function?example?

0 Answers   HCL,


How u call destructor and dispose methode in c#.NET

1 Answers  


What do you mean by parsing and how to parse a date time string in c#?

0 Answers  


What is the use of constructor in c# with example?

0 Answers  


Why c# is type safe?

0 Answers  






What is Implicit conversion in C#?

0 Answers  


What is the difference between Object and class adapters?

0 Answers   QuestPond,


What is multithreading with .net?

0 Answers  


Will finally block get executed if the exception had not occurred?

2 Answers  


Give examples for value types?

0 Answers  


What is a property c#?

0 Answers  


Explain how do you convert a value-type to a reference-type?

0 Answers  


Categories