Method Overriding - Day 6 Flashcards

1
Q

Dynamic polymorphism

A

Like static polymorphism. Polymorphism can also occur at runtime, this is dynamic polymorphism.

Accomplished by overriding the parent method in the child class.

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

When overriding

A

The child class should have the same signature as the parent class.

Method should not have a weaker access modifier

Private methods are not overridden

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

Dynamic binding

A

Datatype = new ();

Version of the method that will be called is determined by the objects this is taken at runtime.

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

Annotations

A

Meta-data that provides data about the program and is not part of the program itself

“@override”

Gives additional information to compiler

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

Super keyword

A

Invokes a parent class method from a child class method

Access a parent class instance variable in the child class there is a variable in the child class with the same name

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

Overloading vs overriding

A

Overloading is compile-time polymorphism

Overriding is runtime polymorphism

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