Define a `Base` class with a `protected` integer attribute `secret`. Define a `Derived` class that inherits `public Base`. Inside `Derived`, create a public method `setSecret(int val)` to modify the inherited protected variable, and a `printSecret()` method to print it. In `main()`, use the `Derived` class to set and print the secret.
A single integer.
Print the formatted secret.
None
42
Secret: 42
Protected members act like private members to the outside world, but are accessible directly within derived child classes.
#include <iostream>
class Base {
// Define protected secret here
};
class Derived : public Base {
public:
// Implement setSecret() and printSecret()
};
int main() {
// Instantiate Derived, read input, and execute
return 0;
}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