59.8k views
4 votes
If part of the original method implementation from the superclass is retained, the rewrite is referred to as _______

a. Overloading
b. Overriding
c. Encapsulation
d. Polymorphism

1 Answer

6 votes

Final answer:

When part of the original implementation from the superclass is retained, the rewrite is referred to as overriding.

Step-by-step explanation:

When part of the original implementation from the superclass is retained, the rewrite is referred to as overriding. This is a concept in object-oriented programming where a subclass provides a different implementation for a method that is already provided by its superclass. The superclass is the class from which the subclass inherits properties and methods. By overriding a method in the subclass, you can customize its behavior while still maintaining the inheritance hierarchy. For example, suppose we have a superclass called 'Animal' with a method 'makeSound()'. If a subclass called 'Cat' extends the 'Animal' class and provides its own implementation of 'makeSound()', it is overriding the method.

User Macaret
by
8.7k points