Write a C++ program that will implement the following tasks to help students understand how the destructors of base and derived classes work. Make sure to use appropriate variable types and display the results clearly.
Base Class Definition:
a) Define a base class named "Shape" with a protected member:
b) name (string): to store the name of the shape.
c) Declare a constructor for the "Shape" class that takes a parameter to initialize the name.
d) Declare a virtual destructor for the "Shape" class.
Derived Class Definition:
a) Define a derived class named "Rectangle" that inherits from the "Shape" class.
b) Add a private member to the "Rectangle" class: length (double): to store the length of the rectangle.
c) Declare a constructor for the "Rectangle" class that takes parameters to initialize the name and length.
d) Declare a destructor for the "Rectangle" class. Object Creation and Destruction: a) Inside the main function, create an object of the "Rectangle" class.
b) Prompt the user to enter values for the name and length of the rectangle.
c) Use the provided input to initialize the object's members.
d) Display the details of the rectangle object.
e) Before the program terminates, display a message.