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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Interface class

A

Set of methods and constants identified with a name. This class also cannot be instantiated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why use Interfaces?

A

To separate the specification available to the user from implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly