ITPEC FE Subject A October 2025 Question 7

In object-oriented programming, which of the following is the concept that refers to a class that defines a method with the same name and type signature as a method in its superclass?

Explanation

Overriding — a subclass redefines an inherited method with the same name and signature, replacing the superclass version.

When the method is called on an object, the version in the object's actual class runs. That is what makes polymorphism work: code written against the superclass calls each subclass's own behaviour.

Answer (d)

Why not others:

  • •(c) Overloading — defines methods with the same name but different parameter lists; the question says the signature is the same
  • •(b) Inheritance — the mechanism by which a subclass receives the superclass's methods in the first place; it does not redefine them
  • •(a) Hiding — a subclass field or static method with the same name conceals the superclass one; it is resolved at compile time, not dispatched at run time like an overridden method

Key rule: Same name and same signature in a subclass is overriding, chosen at run time; same name with different parameters is overloading, chosen at compile time.

System Development Technology · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.