#include <iostream>
using namespace std;

class Matrix
{
	int rows, cols;
	mutable int size;
	Matrix(const Matrix&); //to prevent matrix creation like "Matrix a, b(a), c=a;"
public:
	Matrix();
	Matrix(int, int);
	~Matrix();

	Matrix& operator=(const Matrix&);
	Matrix operator*(const Matrix&);
};


Matrix::Matrix()
{
	cout << "ctor " << this << endl;
	rows=cols=size=0;
}


Matrix::Matrix(int r, int c)
{
	cout << "ctorii " << this << endl;
	rows=r; cols=c;
	size=0;
}


Matrix::~Matrix()
{
	cout << "dtor " << this << endl;
	rows=cols=size=0;
}


Matrix& Matrix::operator=(const Matrix& m)
{
	cout << "=par " << &m << endl;
	rows=m.rows;
	cols=m.cols;
	size=m.size=0;
	return *this;
}


Matrix Matrix::operator*(const Matrix& m)
{
	Matrix res(rows, m.cols);
	cout << "*res " << &res << endl;
	return res;
}


/*
Matrix Matrix::operator*(const Matrix& m)
{
	if(cols==m.rows)
	{
		Matrix res(rows, m.cols);
		cout << "*res " << &res << endl;
		return res;
	}

	Matrix res2;
	cout << "*res2 " << &res2 << endl;
	return res2;
}
*/


int main()
{
	Matrix a(2,3), b(3,4), c;

	c=a*b;

	return 0;
}
