Class Templates

Easy Templates & Generic Programming
Solve in Playground →

Problem Statement

Create a `Container` class template that stores a single private value of type `T`. Provide a constructor to initialize it and a `getValue()` method. In `main()`, read a string without spaces, instantiate a `Container`, and print ‘Value: [string]’.

Input Format

A single word string.

Output Format

Print the formatted string.

Constraints

String will not contain spaces.

Sample Input

HelloWorld

Sample Output

Value: HelloWorld

Explanation

Class templates allow entire classes to operate with generic types, adapting attributes and methods upon instantiation.

Starter Code

#include <iostream>
#include <string>

// Define your Container class template here

int main() {
    // Read string, instantiate Container<std::string>, and print
    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