Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class matrix{
- struct Array;
- Array *pArray;
- public:
- class Dref;
- matrix();
- matrix( unsigned int k);
- matrix( unsigned int w,unsigned int k);
- /*construktor kopiujacy */
- matrix(const matrix &);
- ~matrix();
- matrix& operator=(const double*);
- matrix& operator=(const matrix&);
- matrix operator+ (const matrix &) const;
- matrix operator-(const matrix &) const;
- matrix operator*(const matrix &) const;
- matrix & operator +=(const matrix &);
- matrix & operator -=(const matrix &);
- matrix & operator *=(const matrix &);
- friend ostream& operator<<(ostream&, const matrix&);
- friend istream& operator>>(istream&, const matrix&);
- bool operator==(const matrix&) const;
- double operator()(unsigned int i,unsigned int j) const;
- Dref operator()(unsigned int i, unsigned int j);
- double read(unsigned int i, unsigned int j);
- void write(double **);
- };
- class matrix:: Dref{
- friend class matrix;
- matrix & m;
- int i,j;
- Dref(matrix &mtr, unsigned int ii, unsigned int jj): m(mtr), i(ii), j(jj)
- {
- };
- public:
- operator double() const
- {
- cout << "operator double() const"<<endl;
- return m.pArray->read(i,j);
- }
- };
- inline double matrix::read(unsigned int i,unsigned int j)
- {
- return &matrix[i][j];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement