Method Overriding (Hiding Base Class Methods)

Medium Single & Multilevel Inheritance
Solve in Playground →

Problem Statement

Define a `Base` class with a `void show()` method printing “Base”. Define a `Derived` class that inherits from `Base` and overrides `void show()` to print “Derived”. Call `show()` on a `Derived` instance.

Input Format

None

Output Format

Print the overridden message.

Constraints

None

Sample Output

Derived

Explanation

When a derived class defines a method with the same signature as a base class method, it hides or overrides the base class implementation.

Starter Code

#include <iostream>

class Base {
public:
    // Define show()
};

class Derived {
    // Inherit Base and override show()
};

int main() {
    // Instantiate Derived and call show()
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used