Question:medium

What happens if a derived class defines a function with the same name as a base class function, but with a different parameter list?

Show Hint

Think about C++ name lookup. If a name is found in the derived scope, does the compiler keep looking in the base scope?
Updated On: Jul 2, 2026
  • It overrides the base class function
  • It forces explicit scope resolution to call the base class function
  • It hides the base class function
  • It causes a compilation error
Show Solution

The Correct Option is C

Solution and Explanation

Different angle, using scope rules:

The compiler resolves a name in stages. It first searches the class scope where the call is made. If it finds the name there, it stops and never looks in the base scope.

When Derived declares its own $func$, the name $func$ is found inside Derived. Lookup stops immediately, so the base class overloads become invisible from a Derived object.

Because a different parameter list is not the same signature, this cannot be overriding. It is name hiding. The base overloads are still callable, but only through an explicit qualifier or a using declaration.

Therefore the base class function is hidden.
\[\boxed{\text{It hides the base class function (option C)}}\]
Was this answer helpful?
0