GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ASP.NET 2.0
Go To First  |  Previous Question  |  Next Question 
 ASP.NET 2.0  |  Question 104 of 160    Print  
can an abstract method be overridden by a virtual method

  
Total Answers and Comments: 6 Last Update: December 12, 2007     Asked by: sreejamohan 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: anishcp
 

An abstract method is a method without any method body. When a class inherits from an abstract class, the derived class must implement all the abstract methods declared in the base class. But by declaring the derived class also abstract, we can avoid the implementation of all or certain abstract methods. This is what is known as partial implementation of an abstract class.

A virtual method specifies an implementation of a method than can be polymorphically override in the derived class. When we declare a virtual method, it must contain a method body. It is not necessary to override a base class virtual method inside a derived class.

The abstract methods are implicitly virtual and hence they cant make explicitly virtual in c#



Above answer was rated as good by the following members:
PratapCh, abusaud
August 26, 2006 09:34:41   #1  
rahul        

RE: can an abstract method be overridden by a virtual ...

Hello sir

My Name is rahul.The ans For Your question is It Cannot be overridden by virtul method. If I am Wrong Please Forgive me

byeeeee

Rahul


 
Is this answer useful? Yes | No
August 31, 2006 08:31:36   #2  
Ramya        

RE: can an abstract method be overridden by a virtual ...

Yes

An abstract method can overrides a virtual method


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 12, 2006 12:09:26   #3  
anishcp Member Since: August 2006   Contribution: 6    

RE: can an abstract method be overridden by a virtual ...

An abstract method is a method without any method body. When a class inherits from an abstract class the derived class must implement all the abstract methods declared in the base class. But by declaring the derived class also abstract we can avoid the implementation of all or certain abstract methods. This is what is known as partial implementation of an abstract class.

A virtual method specifies an implementation of a method than can be polymorphically override in the derived class. When we declare a virtual method it must contain a method body. It is not necessary to override a base class virtual method inside a derived class.

The abstract methods are implicitly virtual and hence they cant make explicitly virtual in c#


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 13, 2006 11:50:42   #4  
prudhviram Member Since: September 2006   Contribution: 11    

RE: can an abstract method be overridden by a virtual ...
Yes You can do that I think the explanation about Abstract method and Virtual method is good enough to suffice this.
 
Is this answer useful? Yes | No
December 08, 2006 13:39:37   #5  
Raj        

RE: can an abstract method be overridden by a virtual ...

No it cannot be implemented.

This is due to the fact that a method cannot have both virtual and override qualifier.


 
Is this answer useful? Yes | No
December 12, 2007 17:04:26   #6  
xinper Member Since: December 2007   Contribution: 1    

RE: can an abstract method be overridden by a virtual method
No I tried.


A member 'ClassB.methodA()' marked as override cannot be marked as new or virtual.

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape