Implementing this constructor...

S

sophie

Hi, I have been asked for an exam question to implement the
constructor, copy constructor and destructor for the following class
that describes an n-by-n matrix containing n squared integer values.
(Eg. a matrix of n rows and n colums):

import <iostream.h>

class myMatrix
{

private:
int **data; //pointer to array of n pointers, which in turn point to n
arrays that contain matrix data
int size; //size of matrix

public:
//contructor, matrix elements are initialized with defaultValue
myMatrix(int matrixSize, int defaultValue);


//copy constructor
myMatrix(const myMatrix &v);

//destructor
~myMatrix

};


I'm a bit lost on what "int **data" is. How do you actually use this to
create the constructor? I didn't even know you could declare something
like that. Hopefully someone can sort me out here??? Thanks!!!
 
I

Ian Collins

sophie said:
Hi, I have been asked for an exam question to implement the
constructor, copy constructor and destructor for the following class
that describes an n-by-n matrix containing n squared integer values.
(Eg. a matrix of n rows and n colums):
You again? go next door!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top