목록2024/05/11 (1)
Minwoo Dev.
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bEAyb9/btsHmyuxE5P/ks201ENiE5a5nUQmeXy0c1/img.png)
문제 1Point 클래스에 대해서 다음 조건을 만족하는 형태로 - 연산자를 오버로딩 해보자.전역함수 기반으로 오버로딩멤버 별 - 연산의 결과를 담은 Point 객체 반환 정답소스 코드#include using namespace std;class Point{private: int xpos, ypos;public: Point(int x = 0, int y = 0) : xpos(x), ypos(y) {} void ShowPosition() const { cout 실행 결과 문제 2Point 클래스에 대해서 다음 조건을 만족하는 형태로 += 연산자와 -= 연산자를 오버로딩 해보자.멤버함수 기반으로 오버로딩연산 'pos1 += pos2'의 결과로 pos1의 멤버변수 값이 ..
C++
2024. 5. 11. 20:47