Polymorphism Flashcards

1
Q

Phenomenon where a single name may be used to represent multiple types

A

Polymorphism definition

Additional info:
Polymorphic variable can hold values of different types
Polymorphic function can be applied to arguments of a variety of types

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

Overriding

A

Specific type of polymorphism
When there is a method call from an instance of the subtype referenced by the supertype, the method from the subtype is dynamically bound

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

Objects and behaviors requiring a generic way of handling values in a uniform manner, without worrying about the type

A

Parametric Polymorphism

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

Data types that allow for parametric polymorphism, and the functions that allow of it

A

Generic types; generic functions

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

In Java, casting up along the type hierarchy is automatic and implicit

A

Upcasting or broadening conversion

car is-a vehicle
Vehicle c = new Car();

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

In Java, casing down along the type hierarchy

A

Down casting or narrowing conversion

Car c = (Car) v;

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

What is the ‘diamond problem’

A

Multiple inheritance
Living Thing
/ \
Animal Reptile
\ /
Snake

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

Completely abstract class that is used to group related methods with empty bodies

A

Interface

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