Problem:
문제 8번의 Circle 객체에 대해 다음 연산이 가능하도록 연산자를 구현하라.
| 1 2 3 4 | Circle a(5), b(4); b = 1+a; // b의 반지름을 a의 반지름에 1을 더한 것으로 변경 a.show(); b.show(); |
2020/03/06 - [C++/명품 C++ programming] - 명품 C++ programming Exercise Problem 7장 8번
[명품 C++ programming Exercise Problem 7장 8번
Problem: 원을 추상화한 Circle 클래스는 간단히 아래와 같다. 1 2 3 4 5 6 class Circle{ int radius; public: Circle(int radius=0) { this->radius = radius; } void show() { cout << "radius = " << radius <<..
sobamemil.tistory.com](https://sobamemil.tistory.com/97)
Execution Result:

Objective & Hints:
프렌드 함수로 연산자 구현 연습
Code:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include |