Your task is to demonstrate constructor execution order in Embedded C++ using inheritance.
You must write a C++ program that:
Defines a base driver class with a constructor that prints:
Base driver initialized
Prints:
Derived driver initialized
Provides a function to print:
Driver value <value>
main():The program output must prove that the base class constructor executes before the derived class constructor.
Input:
NProgram Flow (Mandatory Execution Order):
NNN
Example Input:
5
Example Output:
Base driver initialized
Derived driver initialized
Driver value 5
Constraints:
new, malloc)
Input
5
Expected Output
Base driver initialized Derived driver initialized Driver value 5