이걸로 간단하게 << 객체 해서 내가 원하는 대로 출력시킬 수 있잖아요
요것좀 써보려고 하는데
out << 문자열하면 알맞는 인자가 아니라고해서; 다른분들이 한거보면 잘되는데
머가 문젠지 몰겠네요 좀 돠주세여
#include <iostream>
#include <string>
using namespace::std;
class pokemon{
private:
string name;
char lv;
bool life;
public:
friend ofstream& operator<<( ofstream & out, const pokemon & p);
};
ofstream& operator<<( ofstream & out, const pokemon & p){
out << p.name << " : " << p.lv ;
}
int main (){
return 0;
}
ostream을 해야지 ofstream이아니라
제대로 동작할려면 리턴도 하셔야합니다