단항연산자
c++ 단항 연산자 오버로딩 하기
c++ 단항 연산자 오버로딩 하기
2020.11.05#include using namespace std; class Cents { private: int m_cents; public: Cents(int cents= 0) { m_cents = cents; } int getCents() const { return m_cents; } int& getCents() { return m_cents; } }; Cents 클래스를 만들었습니다. 처음으로 할 것은 입출력 operator 를 오버로딩하는 것 입니다. friend std::ostream& operator