16.0k views
2 votes
Four things we can do with an inherited method: When a subclass inherits a method from its superclass, there are four things we can choose to do in the subclass.

a) Override, Overload, Overwrite, Overthink
b) Override, Call, Extend, Ignore
c) Override, Implement, Ignore, Inherit
d) Override, Superclass, Subclass, Abstract

User Jeroent
by
7.6k points

1 Answer

2 votes

Final answer:

A subclass can override, call, extend, or ignore an inherited method from its superclass. ‘Override’ provides a new implementation, 'Call' uses the method as is, 'Extend' adds to the existing functionality, and 'Ignore' chooses not to use the method.

Step-by-step explanation:

When a subclass inherits a method from its superclass, there are certain actions that can be performed with the inherited method. The correct options from the list you provided are:

  • Override: This is when the subclass provides its own implementation of an inherited method.
  • Call: The subclass can call the inherited method directly, using it as it is defined in the superclass.
  • Extend: The subclass may extend the functionality of an inherited method by calling the superclass's version of the method with the super keyword before adding additional code.
  • Ignore: The subclass can simply choose not to use the inherited method.

To clarify, overloading is a separate concept where a class has multiple methods with the same name but different parameters. Overwrite and overthink are not standard terms in the context of object-oriented programming. Moreover, the terms 'Superclass', 'Subclass', and 'Abstract' define concepts and are not actions that can be performed on a method.

User Neilos
by
7.2k points