What does the keyword virtual mean in the method definition?
Answers were Sorted based on User's Feedback
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 |
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 |
Int map to which .net types?
What is the Difference between value and reference type?
Why we use extension methods in c#?
What is generic collection in c#?
What are the different types of assembly?
Explain the top reason to use c# language?
Why do we need constructors?
What is abstract class ?
What is Satellite Assemblies ?
List down the commonly used types of exceptions in .net
Explain the role of the datareader class in ado.net connections?
Define boxing and unboxing in c#?