What does the keyword virtual mean in the method definition?
Answer Posted / 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 |
Post New Answer View All Answers
What is difference between private and static constructor?
Explain publishers and subscribers in events.
What does type safety mean?
Is c# an open source language?
What is a virtual property. Give an example?
What is the difference between serialization and deserialization in c#?
What is continue in c#?
What is Inheritance in C#?
What is null character in string?
What exactly is serverless?
Is nullable type c#?
What are the properties of c#?
What happens if the inherited interfaces have conflicting method names?
What is an Interface in C#?
What are mutable and immutable types in c#?