#include <iostream>
#include <string>
using namespace std;
class phonebook
{
string name;
string prefix;
public:
phonebook(string &name, string &prefix)
{
this->name = name;
this->prefix = prefix;
}
friend istream &operator>>(istream &in, phonebook &book);
};
istream &phonebook::operator>>(istream &in, phonebook &book)
{
in >> book.name >> book.prefix;
return in;
}
int main()
{
return 0;
}
Lorsque je tente de compiler ce code en utilisant g ++ 4.6.1:C++ surcharge >> opérateur erreur de compilation étrange
« main.cpp: 20: Erreur: « std :: istream & répertoire opérateur :: >> (std :: istream &, répertoire &) 'doit prendre exactement un argument'
PS: C'était assez bête de demander ... Tellement évident: S. Merci quand même.