Polymorphism Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is polymorphism?

A

Refers to classes in which the base and derived classes have the same functions.

Using the same method name to indicate different implementations.

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

What is the process of overriding?

A

This is when the methods that a subclass would normally inherit are redefined.

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

What two rules does the compiler follow if the function exists in both the superclass and the derived class?

A
  1. If the function is invoked by the object of the subclass, then the function of the subclass is executed.
  2. If the functions is invoked by the object of the superclass, then the superclass method is executed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What methods cannot be overridden?

A

Private
Static
Final
Methods with final classes

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

What does super() do?

A

Used to call the superclass and access the constructor in the superclass.

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