i have 3 errors that i cant figure out y they are appearing i thought everything was fine

template <class TYPE>
class Darray{
protected:
		TYPE DEPTH;
		TYPE ROW;
		TYPE COL;
		Cell *** array;

public:
	
	Darray();											//constructor
	Darray(TYPE depth, TYPE row, TYPE col);				//overloaded constructor
	~Darray();											//destructor
	Darray(const Darray& darray);						//copy constructor
	Darray& Darray::operator= (const Darray& darray);	//assignment operator

	void getDimensions(TYPE DEPTH, TYPE ROW, TYPE COL);
	void destroy();
	void create();
	void resetSize(TYPE DEPTH, TYPE ROW, TYPE COL);
};

template <class TYPE>
Darray<TYPE>::Darray()
{
	DEPTH=0;
	ROW=0;
	COL=0;
	array=NULL;
}

template <class TYPE>
void Darray<TYPE>::create()
{
	array = new Cell** [DEPTH];
	for(int d=0; d<DEPTH; d++) {
		*(array+d) = new Cell* [ROW];
		for (int r=0; r<ROW; r++)
			*(*(array+d)+r) = new Cell [COL];
	}
}

template <class TYPE>
Darray<TYPE>::Darray(TYPE depth, TYPE row, TYPE col)
{
	DEPTH = depth;
	ROW = row;
	COL = col;
	create();

}

template <class TYPE>
Darray<TYPE>::~Darray()
{
	destroy();
}

template <class TYPE>
Darray<TYPE>::Darray(const Darray& darray)
{
	DEPTH = darray.DEPTH;
	ROW = darray.ROW;
	COL = darray.COL;
	create();

	for(int d=0; d<DEPTH; d++)
		for(int r=0; r<ROW; r++)
			for(int c=0; c<COL; c++)
				array[d][r][c] = darray.array[d][r][c];
}

template <class TYPE>
Darray<TYPE>& Darray<TYPE>::operator= (const Darray& darray)
{
	resetSize(darray.DEPTH, darray.ROW, darray.COL);

	for(int d=0; d<DEPTH; d++)
		for(int r=0; r<ROW; r++)
			for(int c=0; c<COL; c++)
				array[d][r][c] = darray.array[d][r][c];
			
			return *this;	
}
template <class TYPE>
void Darray<TYPE>::destroy()
{
	 for (int d=0; d<DEPTH; d++)
	 {
		 for(int r=0; r<ROW; r++)
			 delete [] *(*(array+d)+r);
		 delete [] *(array+d);
	 }
	 delete [] array;
 }

template <class TYPE>
void Darray<TYPE>::getDimensions(TYPE DEPTH, TYPE ROW, TYPE COL)
{

	cout << "The Depth is: " << DEPTH << "  The Row is: " << ROW
		<< "  The Columns is: " << COL << endl;	
}

template <class TYPE>
void Darray<TYPE>::resetSize(TYPE depth, TYPE row, TYPE col)
{
	Darray temp (*this);
	destroy();
	DEPTH=depth;
	ROW=row;
	COL=col;
	create();

}

error C2063: '=' : not a function.
see reference to class template instantiation 'Darray<TYPE>' being compiled

error C2040: '=' : 'class Darray<TYPE> &(const class Darray<TYPE> &)' differs in levels of indirection from 'int'.
see reference to class template instantiation 'Darray<TYPE>' being compiled.

error C1903: unable to recover from previous error(s); stopping compilation.
see reference to class template instantiation 'Darray<TYPE>' being compiled.

where the error point to is in red and blue is the function

Recommended Answers

All 2 Replies

Darray& Darray::operator= (const Darray& darray);	//assignment operator

->

Darray& operator= (const Darray& darray);	//assignment operator

oh geez how embarising duh. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.