Abstract classes and Interfaces Flashcards
(4 cards)
1
Q
Abstract class
A
Class which cannot be instantiated on its own. It must be extended by another class.
2
Q
Why Use abstract classes (3)
A
Common set of features for all derived classes
Prevents users from handling objects which are too generic
We don’t have to give a full implementation for the class - usually give most of it and let users override
3
Q
Interface class
A
Set of methods and constants identified with a name. This class also cannot be instantiated
4
Q
Why use Interfaces?
A
To separate the specification available to the user from implementation