The Shape Class: The Shape class is an abstract class, which means it's a base class designed to be inherited by other classes. You are provided with the object file (Shape.o
) and header file (Shape.h
) for this class. Importantly, you must not alter Shape.h
.
The Derived Classes: You need to create three derived classes: Circle, Rectangle, and Triangle. Each of these will inherit from the Shape class. For Circle, both the class definition and implementation are provided as examples. You need to use this example to create and define the Rectangle and Triangle classes.
The ShapesDB Framework: This framework acts as a simple database for shapes. Previously, you implemented an array of shape pointers in Assignment 3, which the framework uses. Your task now is to create new shapes (circles, rectangles, and triangles) that the framework can store and manipulate. The source code for the framework is not provided, but you have access to the header file (ShapesDB.h
) and an object file (ShapesDB.o
).
Command Reference: You will extend the framework with several commands for creating different shapes. For example:
circle name xcen ycen radius
creates a new Circle.rectangle name xcen ycen width height
creates a new Rectangle.triangle name x1 y1 x2 y2 x3 y3
creates a new Triangle.The commands for calculating area and drawing shapes are already implemented in the framework.
Sample Session Output: The assignment provides examples of how the framework responds to various commands and how it handles errors. Your implementation should align with these examples.
In summary, your task is to create three new classes that inherit from an existing Shape class without altering the original framework code. These classes will be integrated into the ShapesDB framework, extending its functionality to handle new shape types and respond to specific commands related to these shapes.