Inheriting Attributes and Methods

Easy Single & Multilevel Inheritance
Solve in Playground →

Problem Statement

Define a `Base` class with a public method `void printMsg()` that prints “Inherited Method”. Define a `Derived` class inheriting `Base`. In `main()`, instantiate `Derived` and call `printMsg()`.

Input Format

None

Output Format

Print the exact message from the base class method.

Constraints

None

Sample Output

Inherited Method

Explanation

Derived classes inherit non-private methods from their base class and can use them as if they were defined locally.

Starter Code

#include <iostream>

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

class Derived {
    // Inherit Base
};

int main() {
    // Instantiate Derived and call printMsg()
    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