Witam, mam klasę Matrix
class Matrix {
private:
friend istream& operator >> (istream& _in_stream, const Matrix& _matrix);
friend ostream& operator << (ostream& _out_stream, const Matrix& _matrix);
//friend Matrix operator + (Matrix& _matrix_l, Matrix& _matrix_r);
Matrix& operator = (const Matrix& _matrix_r);
friend bool operator == (const Matrix& _matrix_l, const Matrix& _matrix_r);
friend bool operator != (const Matrix& _matrix_l, const Matrix& _matrix_r);
unsigned int x, y;
float** tab;
public:
Matrix(unsigned int new_x, unsigned int new_y) {
this->x = new_x;
this->y = new_y;
this->tab = new float* [this->y];
for (int i = 0; i < this->y; i++) {
this->tab[i] = new float[this->x];
}
}
~Matrix() {
for (int i = 0; i < this->x; i++) {
delete[] this->tab[i];
}
delete[] tab;
}
};
oraz przeciążony operator przypisania
Matrix& Matrix::operator = (const Matrix& _matrix_r) {
for (int i = 0; i < y; i++) {
for (int k = 0; k < x; k++) {
tab[i][k] = _matrix_r.tab[i][k];
}
}
return *this;
}
Niestety przy próbie odpalenia programu pojawia mi się taki oto komunikat:
Przy próbie dodania "friend" wywala poniższy błąd:
Ktoś ma pomysł dlaczego tak się dzieje? Napisałem wszystko identycznie jak było podane na jednej ze stron (Nie wiem czy mogę według regulaminu dodać link do niej).