14183 - EE2310_Lab12-1   

Description

#include <iostream>
#include <string>
using namespace std;


class GeometricObject {
public:
   GeometricObject();
   GeometricObject(const string& color, bool filled);
   string toString() const;

/* overload the << operator. Google "stream insertion operator" */

/* declare member variables as 'protected' */

};


/*
 * Implement GeometricObject's member/friend functions
 *
 */


//-------------------------------------


class Circle: public GeometricObject {
public:
/*
 * Remove all access functions
 * Declare your constructors
 * Overload the stream insertion operator <<
 */

private:
   double radius;

};


/*
 * Implement Circle's member/friend functions
 *
 */


//-------------------------------------


class Rectangle: public GeometricObject {
public:
/*
 * Do the same things for Circle
 *
 */

private:
   double width;
   double height;
};

/*
 * Do the same things for Circle
 *
 */

/* Do not change main(), or you will lose points */

int main() {
   GeometricObject shape("Red", true);
   Circle circle(5, "black", false);
   Rectangle rectangle(2, 3, "orange", true);
   cout << shape << circle << rectangle;

}

 

Input

Output

Sample Input  Download

Sample Output  Download

Tags




Discuss