Please check the below code
template<class T>
class Row {
public:
Row(int cols=0):row(NULL) {SetRowSize(cols);}
~Row() {SetRowSize(0); }
Row(const Row &r):row(NULL) {
SetRowSize(r.numCols);
for (int i=0;i<numCols;i++)
row[i]=r.row[i];
}
void SetRowSize(int n) {
if(row) delete[] row;
if (n>0) {
row=new T[n];
memset(row,0,sizeof(T)*n/sizeof(char));
}
else row=NULL;
numCols=n;
}
int size() { return numCols;}
private:
int numCols;
T* row;
};
Here at line 6 we have Row(const Row &r):row(NULL) {
, what is the use of declaring an object using referencing operator? can't we declare it as Row(const Row r):row(NULL) {
doesn't it have the same meaning?