Define an abstract Shape class with pure virtual functions area() and perimeter(). Both return double. Create concrete classes Circle and Rectangle that implement these functions with their formulas.
Write a function that takes a Shape reference and prints its area and perimeter. Pass both Circle and Rectangle objects to this function and verify correct output for each shape. Add a Square class that inherits from Rectangle.
Override only what's necessary. Test that Square works correctly with the same print function without any changes to that function.