[Solved] SOLVED: Homework 6

$25

File Name: SOLVED:_Homework_6.zip
File Size: 169.56 KB

SKU: [Solved] SOLVED: Homework 6 Category: Tag:
5/5 - (1 vote)

What is the output of the following C++ program? #include #include using namespace std; class Circle { public: Circle(double radius) {this-radius = radius; } void put() const {cout << Radius = << radius;} private: double radius; }; class ColoredCircle: public Circle { public: ColoredCircle(double radius, string color); void put() const; private: string color; }; ColoredCircle::ColoredCircle(double radius, string color) : Circle(radius), color(color) {} void ColoredCircle::put() const { Circle::put(); cout << Color = << color; } int main() { ColoredCircle redCircle(100., red); Circle* circle1 = &redCircle; circle1-put(); cout << endl; Circle circle(50.); Circle* circle2 = &circle; circle2-put(); cout << endl; return 0; } Modify the program so that the put function is virtual. What is the output after that change?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED: Homework 6
$25