OOP Challenge: Final Comprehensive System Build

Hard Design Patterns & Final Challenges PRO
🔒 Login to Unlock

Problem Statement

Combine the concepts! Build a `LogManager` Singleton class. It uses a Factory method `createLogger(string type)` to generate and return a base `Logger*`. `ConsoleLogger` and `FileLogger` derive from `Logger` and override a `log(string msg)` method printing ‘Console: [msg]’ and ‘File: [msg]’. In `main()`, retrieve the singleton, read a type (‘Console’ or ‘File’) and a message, create the logger, and log the message.

Input Format

A string type followed by a string message.

Output Format

Print the logged format.

Constraints

None

Sample Input

Console Error404

Sample Output

Console: Error404

Explanation

A robust systems-level architecture using Singleton controllers orchestrating abstract interfaces instantiated via Factory methods.

Starter Code

#include <iostream>
#include <string>

class Logger {
public:
    virtual void log(std::string msg) = 0;
    virtual ~Logger() {}
};

// Implement ConsoleLogger, FileLogger, and Singleton LogManager with Factory Method

int main() {
    // Retrieve manager, parse input, create logger, and log
    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