Question: c++ code. write the code for the beginner Each file contains points which form either a square, triangle, and rectangle. Create a derived class for
c++ code. write the code for the beginner
Each file contains points which form either a square, triangle, and rectangle. Create a derived class for each shape which uses the "Shape" class as a base. Add a virtual "area" and "perimeter" function to the base the class and implementation for each of these in the derived square, triangle, and rectangle classes. Feel free to add any additional data member objects for these shapes as you find helpful (such as a side length for squares, length and width for rectangles.) Create an overloaded constructor which uses 3 points as input for the triangle class, and 4 points for the square and rectangle.
file1:
0,0
2,0
0,2
2,2
file2:
0,0
2,0
1,1
file3:
0,0
2,0
0,4
2,4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
