Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef TRANSFORMMATRIX_H
- #define TRANSFORMMATRIX_H
- #include "matrix.h"
- #include "math.h"
- class BaseTransformMatrix : public Matrix<double>
- {
- public:
- BaseTransformMatrix();
- };
- class MoveMatrix : public BaseTransformMatrix
- {
- public:
- MoveMatrix(double x, double y, double z);
- };
- #endif // TRANSFORMMATRIX_H
- #ifndef MATRIX_H
- #define MATRIX_H
- #include "vector.h"
- #include "base_matrix.h"
- template <typename T>
- class Matrix : public BaseMatrix
- {
- public:
- Matrix();
- Matrix(int m, int n);
- ... // Other methods and fields
- private:
- Vector<Vector<T>> matr;
- };
- #include "matrix.cpp" // Файл реализации с методами
- #endif // MATRIX_H
- #ifndef BASE_MATRIX_H
- #define BASE_MATRIX_H
- class BaseMatrix
- {
- protected:
- int m;
- int n;
- public:
- BaseMatrix();
- BaseMatrix(int m, int n);
- BaseMatrix(const BaseMatrix &matrix) = delete;
- virtual ~BaseMatrix() {}
- int length_m() const;
- int length_n() const;
- bool isEmpty() const;
- };
- #include "base_matrix.cpp" // Опять же файл реализации
- #endif // BASE_MATRIX_H
- #ifndef BASE_MATRIX_CPP
- #define BASE_MATRIX_CPP
- #include "base_matrix.h"
- BaseMatrix::BaseMatrix():m(0), n(0) {}
- BaseMatrix::BaseMatrix(int m, int n):m(m), n(n) {}
- int BaseMatrix::length_m() const
- {
- return this->m;
- }
- int BaseMatrix::length_n() const
- {
- return this->n;
- }
- bool BaseMatrix::isEmpty() const
- {
- if (this->m && this->n)
- return false;
- else
- return true;
- }
- #endif // BASE_MATRIX_CPP
- ...myTestbase_matrix.cpp:11: ошибка: multiple definition of `BaseMatrix::length_m() const'
- ...myTestbase_matrix.cpp:11: first defined here ...myTestbase_matrix.cpp
- ...myTestbase_matrix.cpp:17: ошибка: multiple definition of `BaseMatrix::length_n() const'
- ...
- int main(){}
Add Comment
Please, Sign In to add comment