C++.NET

Moderators: Lundin
Number of threads: 99
Number of posts: 163

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to write method destructor ~Matrix in my class? Posted by 06hc123 on 1 Mar 2009 at 9:14 PM
I wrote class Matrix

class Matrix
{
	int rows;
	int cols;
	int **MT;
public:
	Matrix(const Matrix &M);
	Matrix(int Rows=0, int Cols=0);
	Matrix();
	~Matrix();
	const Matrix & operator=(const Matrix &M);
	friend Matrix operator+(const Matrix,const Matrix);
	friend Matrix operator-(const Matrix,const Matrix);
	friend Matrix operator*(const Matrix,const Matrix);
	friend ostream& operator<<(ostream &, const Matrix &);
	friend istream& operator>>(istream &, Matrix &);
};
 
Matrix::Matrix(int Rows, int Cols)
{
	rows=Rows;
	cols=Cols;
	MT=new int *[rows];
	for(int i=0; i<rows; i++)
		MT[i]=new int[cols];
}

Matrix::~Matrix()
{
	//what is source code here ???
}




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.