The final Specifier

Easy Virtual Functions & Abstract Classes
Solve in Playground →

Problem Statement

Create a `Car` class with a method `virtual void drive() final` that prints ‘Driving’. Because it is `final`, no subclass can override it. Instantiate a `Car` and call `drive()`.

Input Format

None

Output Format

Print the message.

Constraints

None

Sample Output

Driving

Explanation

The `final` keyword prevents derived classes from overriding a specific virtual method, enforcing a strict implementation down the hierarchy.

Starter Code

#include <iostream>

class Car {
public:
    // Implement virtual method with final specifier
};

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