Cześć
Mam problem z przeciążonym operatorem.Kiedy zdefiniuje konstruktor w klasie program nie chce się skompilować. Jak usunę konstruktor program się kompiluje.
klase stworzyłem w pliku nagłówkowym ale wszystko złączyłem w jeden plik aby nie wstawiać 3 code snippet (coś takiego :P) .
#include <iostream>
using namespace std;
class Time
{
private:
int x;
int y;
public:
Time(int x1,int y1);
Time operator+(const Time & t) const;
};
int main()
{
Time czas = Time(14,10);
return 0;
}
Time Time::operator+(const Time & t) const
{
Time sum;
sum.x = x + t.x;
sum.y = y + t.y;
return sum;
}
Time::Time(int x1,int y1)
{
x1=x;
y1=y;
}
Za wszelką pomoc dziękuje ;)