니가 오류난건 이항인데 단항으로 처리해서 그렇다.
쉬프트 이항이다 단항 없다. MSDN봐라
이하는 소스본다.
#include "stdafx.h"
#include <iostream>
class Time
{
public:
int poo;
public:
Time& operator++ ()
{
this->poo += 1;
return *this;
}
void operator>> (int _a)
{
this->poo += _a;
}
int operator() (Time& t1 )
{
return t1.poo;
}
void operator+ ()
{
std::cout << this->poo << std::endl;
}
friend void operator>> (std::ostream& o1 ,Time& t1);
Time (int _poo):poo(_poo){}
~Time() {}
};
void operator>> (std::ostream& o1 ,Time& t1)
{
std::cout << t1.poo << std::endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
Time foo = Time(0);
std::cout << foo.poo << std::endl; // 출력
++foo;
std::cout >> foo; //출력
foo>>1;
+foo; //출력
return 0;
}
예쁘게 그런거 없다. 몇 줄안된다 띄우기 없이도 봐라.
ostream의 >> 연산자를 friend 권한 줄때 리턴값을 void로 줬으니 써보다 바꿔라
ㄳ 해결했음