#include <iostream>
using namespace std;
class Point {
int x;
int y;
public:
explicit Point(int _x = 0, int _y = 0) : x(_x), y(_y) {}
void Print() const { cout << x << ',' << y << endl; }
//포인터 객체를 int형으로 변환
operator int() const {
return x;
}
};
void main() {
int n = 10;
Point pt(2, 3);
n = pt; //pt.operator int() 암시적 호출
//operator int()를 통해 pt의 x값만 반환시켜 n에 들어가기 때문에 pt의 x값인 2가 n에 들어가 있음.
cout << n << endl;
}