Deadline is Thu Nov-08 ! I want it in C++ code ( C plus plus ), please !! thanks
ID: 3655173 • Letter: D
Question
Deadline is Thu Nov-08 !
I want it in C++ code ( C plus plus ), please !! thanks a lot
Put all the following in a file called shapes.cpp: Define a struct called point with components xcoordinate and yCoordinate of type integer. Define a class called shape without any member. Define a class called triangle, which publicly inherits shape and has the three data members first, second, and third of type point Define a class called square, which publicly inherits shape and has the two data members first of type point and length of type double: Define a class called rectangle, which publicly inherits shape and has the two data members first and second of type point Define a class called circle, which publicly inherits shape and has the two data members first of type point and radius of type double Each of the four classes triangle, square, rectangle, circle has the following member functions: reads the data members of the shape void set(): void draw() const plots the shape Write a driver that does the following: Declare an array of pointers of type point and size 4 The pointers point to new objects of type triangle, square, rectangle, circle respectively In a for loop, make each pointer invoke the set function In a for loop, call clrscr make each pointer invoke the draw() function, call delay() Implement the two member functions se and draw for each class to Hint: The function gotoxyGr, y) moves the courser to the position Gr, y)Explanation / Answer
struct point { int xCoordinate,yCoordinate; } void shape(); void triangle() { point first,second,third; void set(); void draw()const; } void square() { point first; double lenght; void set(); void draw()const; } void rectangle() { point first,second; void set(); void draw()const; } void circle() { point first; double radius; void set(); void draw()const; } point *p[4];
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.