Question

Question 4 Design a C++ class that represents a 2D shape, such as a rectangle or circle. The class should have fields to store the dimensions of the shape, such as width and height for a rectangle or radius for a circle. The class should also have methods to calculate and return the area and perimeter of the shape. In addition, the class should have methods to compare two shapes, returning whether they are equal in area and/or perimeter. Design and implement the Shape class, and provide sample code demonstrating how to create objects of the class, set their dimensions, and perform operations such as calculating their area and perimeter and comparing them to other shapes. (30)

Fig: 1