Hi!

I wrote two functions in order to access two private data members of a template class and I got the messages in the title every time I call these functions(getNcols(), getNrows()). I'd be very grateful for your help, guys...
(Without the "template<class T>" before the friends, I got linker errors and a simpler code worked with them, so I suppose they are needed...) Here comes the code. Thx, gyagyus.

template<class T>
class Matrix : public Vector< Vector<T> >{
 private:
//Vector<Vector<T>> v; 	// Vector used to store the matrix elements
int nrows;  	// number of rows of the matrix
int ncols;	// number of columns of the matrix

public:
Matrix(); // default constructor, uses default constructor for v
Matrix(int Nrows, int Ncols);  // alternate constructor
//T& operator() (int i, int j) const; //  function call overload (-,-)
template<class T> friend Matrix<T> operator*(const Matrix<T>& m1, const Matrix<T>& m2); // overload * for matrix multiplication
template<class T> friend std::istream& operator>>(std::istream& is, Matrix<T>& m);// keyboard input
template<class T> friend std::ostream& operator<<(std::ostream& os, Matrix<T>& m);// screen output
template<class T> friend std::ifstream& operator>>(std::ifstream& ifs, Matrix<T>& m);// file input
template<class T> friend std::ofstream& operator<<(std::ofstream& ofs, Matrix<T>& m);// file output
int GetNrows() const; // access function
int GetNcols() const; // access function
};

template<class T>
Matrix<T>::Matrix() : Vector< Vector<T> >(), nrows(0), ncols(0)/*, Vector() */{}// default constructor, uses default constructor for v

template<class T>
Matrix<T>::Matrix(int Nrows, int Ncols) : Vector< Vector<T> >(), nrows(Nrows), ncols(Ncols)/*, Vector(Nrows)*/  // alternate constructor
{
	for (int i = 0; i < Nrows; i++)
	{
		/*const Vector<T>* d = new Vector<T>(Ncols);
		this[i] = d;*/
		Vector<T>* d = new Vector<T>(Ncols);
		const Vector<T> &h = *d;
		this[i] = h;
		//this[i] = *(new Vector<T>(Ncols));//this[i] = &(*(new Vector<T>(Ncols)));//this[i] = *(new Vector<T>(Ncols));
	}
}

// return the number of rows
template<class T>
int Matrix<T>::GetNrows() const
{
  	return nrows;
}

// return the number of columns
template<class T>
int Matrix<T>::GetNcols() const
{
  	return ncols;
}
Comments
Congrats on using code tags on your first post.
This question has already been answered. Start a new discussion instead.