#include <iostream

#include <stdio.h>
namespace mystd                                                             
{

class ostream
{
public:                                                                  
ostream& operator<< (char * str) 
{
printf("%s", str);
return *this;
}
ostream& operator<< (char str) 
{
printf("%c", str);
return *this;
}
ostream& operator<< (int num) 
{
printf("%d", num);
return *this;
}
ostream& operator<< (double e) 
{
printf("%g", e);
return *this;
}
ostream& operator<< (ostream& (*fp)(ostream &ostm))
{
return fp(*this);
}
};

ostream& endl(ostream &ostm)
{
ostm<<'\n';
fflush(stdout);
return ostm;
}
ostream cout;
}

보시다싶이 ostream의 cout과 endl 간단히 구현된 코드입니다

책에서 보다가 이해가 안가는 점이있는데 

ostream& operator<< (char * str) 
{
printf("%s", str);
return *this;
              }
1.반환값을 void로 바꾸고 출력만하면 될거같은데 어째서 반환값이 있는지

2.*this는 갑자기 어디에서 튀어나온건지

3.ostream& 이 ostream의 참조값이라고만 명칭만 알고있는데 이게 무슨역활인지 자세히 알고싶습니다 ㅜㅜ