オーバーロード出力演算子を含む次のコードがあります。
class Student
{
public:
string name;
int age;
Student():name("abc"), age(20){}
friend ostream& operator<<(ostream&, const Student&);
};
ostream& operator<<(ostream& os, const Student& s)
{
os << s.name; // Line 1
return os;
}
これに変更した場合の違いは何だろうと思っていましたLine 1
:cout << s.name
?