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

In the page load event I assigned dropdownlist’s datasource property to a valid list. On the submit button click.. The same datasource property is coming as null. Why?

0 Answers  


Explain concurrency with aop?

0 Answers  


Why would you use untrusted verificaion?

1 Answers  


write code for Factorial?

6 Answers   Tech Mahindra,


Define using statement in c#?

0 Answers  






What is the difference between malloc () and new?

0 Answers  


What is arraylist c#?

0 Answers  


FOR EXAMPLE : CLASS Dotnet { } creating object: Dotnet dn=new Dotnet(); NOW THE QUESTION IS WHICH IS CALLED AS OBJECT ?EITHER dn OR new Dotnet() and CAN YOU PROVE YOUR ANSWER?????PLEASE REPLY...

1 Answers  


What are the 2 broad classifications of data types available in c#?

0 Answers  


Can you inherit from multiple classes in c#?

0 Answers  


Is c# good for web development?

0 Answers  


Can mvc be used for desktop applications?

0 Answers  


Categories