Question: Create a class called Circle which inherits from Sortable. A Circle object will only have a radius. Circle objects are compared according to radius. Circleobjects

Create a class called Circle which inherits from Sortable. A Circle object will only have a radius. Circle objects are compared according to radius. Circleobjects should be printed one per line as follows, Circle with radius: x, where x is the radius of the circle.

can test your code with the file sortingCircles.cpp as well as the Sortable.h file and the Data.h file

Create a class called Circle which inherits from Sortable. A Circle object

Data.h Sortable.h #ifndef DATAh #define DATA h 1 ifndef LA6_Sortable_h #define LA6Sortableh - - - 4 class Sortable f 4 #includeiostream 5 #includevector 6 #include "Sortable"h" 7 using namespace std; 6 public: virtual bool compare (const Sortable * s)e; virtual void print)- e 9 class Data 9 1e 11 #endif 10 private: vectorsor; 12 13 public: 14 15 16 17 18 19 20 21 void add(Sortable *s)f Line 1, Column 1 sor.push_back (s); sortingCircles.cppx #include compare(sor[j])) 1 myData.add (new Circle()); myData.add (new Circle(3)); myData.add (new Circle(2)); myData.add (new Circle(4)); myData.add(new Circle(1)); sor[j+1] sor[j]: j-j-1; 12 13 sor[j+1]value; 15 16 17 18 19 20 21 myData.print); myData.sort(); myData.print(); void print()( 34 35 36 37 38 39 : 40 41 #endif for(int i-e; i sor.size(); i++) sor[i]->print); 23 24 25 return e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!