Your task is to demonstrate destructor execution order in Embedded C++ using inheritance.
You must write a C++ program that:
Defines a base driver class with a destructor that prints:
Base driver destroyed
Has a destructor that prints:
Derived driver destroyed
Input:
(Input is only used to keep the program structure consistent; it does not affect destruction order.)
Program Flow (Mandatory Execution Order):
main()
Example Input:
5
Example Output:
Base driver initialized Derived driver initialized Derived driver destroyed Base driver destroyed
Constraints:
new
malloc
Test Cases
Test Results
Input
Expected Output