Static Member Functions

Easy Static Members & Friend Functions
Solve in Playground →

Problem Statement

Create a `Config` class with a private static integer `version` initialized to 1. Provide a public static member function `int getVersion()` that returns this value. In `main()`, call this static method directly via the class name and print ‘Version: [v]’.

Input Format

None

Output Format

Print the version formatted.

Constraints

None

Sample Output

Version: 1

Explanation

Static member functions can be called directly without an object and can only access static data members of the class.

Starter Code

#include <iostream>

class Config {
    // Declare private static data and public static method
};

// Initialize static data

int main() {
    // Call getVersion() statically 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