Tuesday 19 January 2016

What is an Abstract class?

Abstract classes, which declared with the abstract keyword, cannot be instantiated. It can only be used as a super-class for other classes that extend the abstract class. Abstract class is the concept and implementation gets completed when it is being realized by a subclass. In addition to this a class can inherit only from one abstract class (but a class may implement many interfaces) and and must override all its methods/properties that are declared to be abstract and may override virtual methods/ properties. Abstract classes are ideal when implementing frameworks. 

In real world fruit is an abstract base class, no object of fruit class, having banana, apple as its derived classes are with objects, for more detail on this comment, for some example in c++/java, please wait and keep on reading....



No comments:

Post a Comment