Abstract Classes

Medium Virtual Functions & Abstract Classes
Solve in Playground →

Problem Statement

Create an abstract class `Document` with a pure virtual method `printDoc()`. A class is abstract if it contains at least one pure virtual function, and cannot be instantiated. Create a `PDF` class that implements `printDoc()` by outputting ‘PDF Printed’. Call the method using a pointer.

Input Format

None

Output Format

Print the document status.

Constraints

None

Sample Output

PDF Printed

Explanation

Abstract classes serve solely as strict blueprints. You cannot create objects of them directly.

Starter Code

#include <iostream>

class Document {
public:
    // Make this an abstract class
};

class PDF : public Document {
public:
    // Fulfill the contract
};

int main() {
    // Execute
    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