Witam
Mam taki kod:
/
#include "stdafx.h"
#include <iostream>
using namespace std;
class Dane{
friend Dane operator-(double y, Dane& X);
friend ostream& operator<<(ostream& out, Dane X);
double a;
long double b;
public:
//konstruktory:
Dane(double x):a(x),b(x){}
Dane():a(1),b(1){}
//operatory:
Dane operator++(int)
{
Dane wynik(*this);
a++; b++;
return wynik;
}
Dane& operator +=(Dane &X)
{
a += X.a;
b += X.b;
return *this;
}
operator float()
{
return (float)a;
}
bool operator==(Dane& X)
{
if(a==X.a && b==X.b)
return 1;
else
return 0;
}
Dane& operator--()
{
a--; b--;
return *this;
}
Dane operator-()
{
Dane wynik;
wynik.a = -a;
wynik.b = -b;
return wynik;
}
};
Dane operator-(double y, Dane& X)
{
Dane wynik;
wynik.a = y - X.a;
wynik.b = y - X.b;
return wynik;
}
ostream& operator<<(ostream& out, Dane X)
{
out<<X.a<<endl<<X.b;
return out;
}
int main()
{
Dane A(-3.1415),B(A), C, D; // wartości domniemane = 1
C += (-1.0 - (A++));
float z = C;
bool b = D == B;
C = - (--A);
cout << A;
system("pause");
}
I nie mogę dojść dlaczego przy kompilacji wyrzuca mi błąd...
Z góry dzięki za pomoc.