Multiple Inheritance Syntax

Easy Multiple & Virtual Inheritance
Solve in Playground →

Problem Statement

Define two base classes: `Engine` with a method `startEngine()` printing ‘Engine started’, and `Wheels` with a method `spinWheels()` printing ‘Wheels spinning’. Create a derived class `Car` that publicly inherits from both. In `main()`, instantiate `Car` and call both methods.

Input Format

None

Output Format

Print the two messages on separate lines.

Constraints

None

Sample Output

Engine started
Wheels spinning

Explanation

Multiple inheritance allows a class to inherit from more than one base class using a comma-separated list.

Starter Code

#include <iostream>

class Engine {
public:
    // Write your code here
};

class Wheels {
public:
    // Write your code here
};

class Car {
    // Inherit from Engine and Wheels
};

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