Witam!
Problem polega na tym, że mimo pzypisania do funkcji zaprzyjaźnionych obiektów klas kompilator zwraca błąd wywołania (lub po prostu nie widzi ich w klasie). Dlaczego ?
Oto błędy programu
main4.cpp: In function ‘int main()’:
main4.cpp:20:32: error: ‘class Time’ has no member named ‘operator+’
total = coding.operator+(fixing); //zapis operacyjny
^
main4.cpp:24:32: error: ‘class Time’ has no member named ‘operator-’
minus = fixing.operator-(coding); //zapis operacyjny
^
main4.cpp:36:37: error: ‘class Time’ has no member named ‘operator+’
total = more_fixing.operator+(total); //dodanie wartości do total !
class Time
{
private:
int hours, minutes;
public:
Time();
Time(int hour, int minut = 0);
friend Time operator+(const Time & all_time);
friend Time operator-(const Time & all_time);
friend Time operator*(double value, const Time & all_time);
void show() const;
};