Introduction To Programming - CS201 Power Point Slides Lecture 44
Introduction To Programming - CS201 Power Point Slides Lecture 44
Programming
Lecture 44
Class Matrix
class Matrix
{
private :
int numRows , numCols ;
double ** elements ;
};
Class Matrix
class Matrix
{
private :
int numRows , numCols ;
double ** elements ;
public :
Matrix ( int = 0 , int = 0 ) ; // Default construc
constru
Matrix ( const Matrix & ) ; // Copy constructo
~ Matrix ( ) ; // Destructor
Class Matrix
// Utility functions of Matrix class
// Plus Operator
Matrix operator + ( Matrix & m ) cons
Matrix operator + ( double d ) const ;
A+
d is a variable
‘A’ is an object of a of type double
class Matrix
d+
d is a ‘a’ is an
variable of object of a
type double class Matrix
Class Matrix
// Plus Operator
A–d;
d is a ‘a’ is an
variable of object of a
type double class Matrix
d–A;
Class Matrix
// Minus Operator
A*d;
d is a
variable of ‘a’ is an
type double object of a
class Matrix
d*A;
Class Matrix
// Multiplication Operator
cin >> m ;
// Where m is a matrix
Class Matrix
// Stream Insertion and Extraction Operator