When a method in a subclass has the same name and type signatures as a method in the superclass, then the method in the subclass _____ the method in the superclass.
(A) Overloads
(B) Friendships
(C) Inherits
(D) Overrides
Answer: (D)
Explanation:
- When a method in a subclass has the same name and type signatures as a method in the superclass, then the method in the subclass overrides the method in the superclass.
- Overloading allows different methods to have same name, but different signatures where signature can differ by number of input parameters or type of input parameters or both. Overloading is related to compile time (or static) polymorphism..
- Friend Class A friend class can access private and protected members of other class in which it is declared as friend..
- The capability of a class to derive properties and characteristics from another class is called Inheritance.
So, option (D) is correct.
Quiz of this Question
Article Tags :
Recommended Articles