What are abstract class and Interface are used for in OOP? Is there any examples to show the advantages of using abstract class or Interface? Please give me detail.
Printable View
What are abstract class and Interface are used for in OOP? Is there any examples to show the advantages of using abstract class or Interface? Please give me detail.
If you would have taken pain to looked into your book then you wouldn't have asked this question...these basic concepts are clearly mentioned in every book.
anywys take a look at this
Abstract Class
An abstract class, or abstract base class (ABC), is one that is designed only as a parent class and from which child classes may be derived, and which is not itself suitable for instantiation. Abstract classes are often used to represent abstract concepts or entities. The incomplete features of the abstract class are then shared by a group of sibling sub-classes which add different variations of the missing pieces.
Interface
An interface is similar to an abstract class in that its members are not implemented. In interfaces, none of the methods are implemented. There is no code at all associated with an interface.