Polymorphism Flashcards

1
Q

Polymorphism

A

The ability for a subclass to be treated as its superclass, while still providing subclass specific responses. The subclass can be treated generically while still providing non-generic, specific functionality.

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

Polymorphism through inheritance

A

A class can be treated as any superclass in their hierarchy. Every reference type in Java can be treated as an object since it is the root superclass of all hierarchies.

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

Interface

A
Defines what something can do or how it can be used, but not how it does it. Provides method signatures, but not implementation. A single class may have multiple interfaces, allowing it to be part of multiple groupings.
Can represent either a HAS-A or an IS-A relationship
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Interface characteristics

A

Interfaces contain only method signatures. The accessor is optional since methods in an interface can only be public. Interfaces cannot be instantiated
Interfaces cannot have member variables.

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