110. Name Hiding in Inheritance

In embedded firmware development, base driver classes often expose low-level configuration helpers that accept explicit parameters.
Derived driver classes may add simplified or default configuration APIs using the same function name.

In C++, this can cause name hiding, where the derived function hides all base class overloads with the same name, unintentionally making base functionality inaccessible.

Your task is to fix a name-hiding issue so that both base and derived configuration functions can be used on the same object.

Given Scenario

You are given:

  • A BaseDriver class that provides a configuration helper:

    configure(int value)

    This represents a generic hardware configuration step using an explicit parameter.

  • A DerivedDriver class that provides a simplified configuration function:

    configure()

    This represents a default configuration mode.

Because both functions share the same name, the base class function becomes hidden when accessed through a DerivedDriver object.

Objective

Modify the program so that:

  • The derived driver’s default configuration runs
  • The base driver’s parameterized configuration can also be called through the derived object

Rules (Strict)

You must follow all rules below:

  • Do NOT rename any functions
  • Do NOT modify the base class implementation
  • Do NOT use virtual functions
  • Do NOT use dynamic memory allocation
  • Do NOT use composition
  • You MAY use using to expose base class functions
  • Output text and order must match exactly

Input

  • One integer value N

Program Flow (Mandatory Order)

  1. Read integer N
  2. Create a DerivedDriver object
  3. Call:
    • configure()
    • configure(N)

Example Input

8

Example Output

Derived default configuration
Base configuration value 8 

Constraints

  • Use public inheritance
  • Both configuration functions must be callable on the same object
  • Use only standard input and output

 

 

Loading...

Input

8

Expected Output

Derived default configuration Base configuration value 8