UGC-NET | UGC NET CS 2016 July – II | Question 14

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



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.