Protected Attributes Convention

Medium Encapsulation & Data Hiding
Solve in Playground →

Problem Statement

Create a `BaseEmployee` class with a protected attribute `_salary`. Create a derived class `Manager` that contains a method `display_salary()` which prints ‘Salary: [_salary]’.

Input Format

A single integer for salary.

Output Format

Print the formatted salary.

Constraints

salary >= 0

Sample Input

50000

Sample Output

Salary: 50000

Explanation

Protected attributes are designed to be accessed within the class and its subclasses, but generally not from the outside.

Starter Code

class BaseEmployee:
    # Define __init__ setting _salary
    pass

class Manager(BaseEmployee):
    # Define display_salary method
    pass

if __name__ == '__main__':
    s = int(input())
    # Instantiate Manager and display
    pass

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