Thursday, June 12, 2014

Abstract Function VS Virtual Function

Abstract Function has no Implementation and it can only declared in abstract class although 
Virtual Function can have implementation and can declared in any type of class except sealed class.

When I should use abstract function or virtual function ?
If you need to enforce any derived class to implement this function, you should use abstract function. 
And if you need function to be optional for derived class to implement or not , you should use virtual function. 

No comments:

Post a Comment