Hallo,
Ik probeer het volgende stukje code te compileren:
# include <iostream>
# include <iomanip>
# include <string>
# include <cmath>
using namespace std;
// klassen - structuren
class CComplex
{
public:
CComplex(double dRe = 0, double dIm = 0);
CComplex(string strTekst);
CComplex operator!();
CComplex operator*(const CComplex &oGetal);
friend ostream& operator<<( ostream& uit, const CComplex& oGetal );
friend istream& operator>>( istream &in, CComplex& oGetal )
{
cout <<" Geef het Reeel deel in: ";
in >> oGetal.dRe;
cout <<" Geef het imaginair deel in: ";
in >> oGetal.dIm;
return in ;
}
friend double dFDouble(const CComplex &oCmplx);
CComplex CFProduct(const CComplex &oCmplx2) const;
private:
double dRe, dIm ;
};
// constanten
// prototypes
// hoofdprogramma
void main()
{
CComplex oGetal1();
cin >> oGetal1;
}
Voor het allerlaatste statement krijg ik de volgende foutmelding:
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'CComplex (__cdecl *)(void)' (or there is no acceptable conversion)
Hoe kan dit. Ik heb volgens mij toch geen fout gemaakt in de definitie van de functie.
Alvast bedankt
Ik probeer het volgende stukje code te compileren:
# include <iostream>
# include <iomanip>
# include <string>
# include <cmath>
using namespace std;
// klassen - structuren
class CComplex
{
public:
CComplex(double dRe = 0, double dIm = 0);
CComplex(string strTekst);
CComplex operator!();
CComplex operator*(const CComplex &oGetal);
friend ostream& operator<<( ostream& uit, const CComplex& oGetal );
friend istream& operator>>( istream &in, CComplex& oGetal )
{
cout <<" Geef het Reeel deel in: ";
in >> oGetal.dRe;
cout <<" Geef het imaginair deel in: ";
in >> oGetal.dIm;
return in ;
}
friend double dFDouble(const CComplex &oCmplx);
CComplex CFProduct(const CComplex &oCmplx2) const;
private:
double dRe, dIm ;
};
// constanten
// prototypes
// hoofdprogramma
void main()
{
CComplex oGetal1();
cin >> oGetal1;
}
Voor het allerlaatste statement krijg ik de volgende foutmelding:
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'CComplex (__cdecl *)(void)' (or there is no acceptable conversion)
Hoe kan dit. Ik heb volgens mij toch geen fout gemaakt in de definitie van de functie.
Alvast bedankt