-1
コンパイラは「非静的メンバー 'it'の無効な使用はなぜですか?」 継承は正しいですが、なぜそれを使用してallInfoベクトル。エラー:非スタティックメンバーの無効な使用
class JSON{
private:
vector<myType> allInfo;
public:
friend ostream &operator<<(ostream &os,const JSON &js)
{
vector<myType>::iterator it;
it = this->allInfo.begin();
for(it; it != allInfo.end();it++){
cout << "this is the info "<<(it->getNAME()) << endl;
}
return os;
};
};
'js.allInfo'(と' const_iterator')が必要です。 'operator <<'はJSONのメンバーではありません。 JSONのメンバーにアクセスするには、取得するオブジェクトを指定する必要があります。幸いにも、1つは手軽にパラメータとして渡されます。 –