hey,
i cant understand whats wrong, i guess there is a syntax error
or i didnt include something....


i uploaded only the header file...


thanks...

Attachments
#ifndef _Class_Array_h
#define _Class_Array_h


template <class T>
class Array
{
private:
	T** arr;
	int lgcSize,phsSize;
public:
	Array(int size);
	Array(const Array& arr);
	~Array();

	const Array& operator=(const Array& other);
	const Array& operator+=(const T& t);
	T& operator[](int index);
	

	friend ostream& operator<<(ostream& out,const Array& arr);
};





#endif //_Class_Array_h

That header file looks okay. There may be an include you need, but I don't see anything that should need one. The error must be in another file in your solution/project.

Is this file #included after another file that could perhaps have an error in it? This is generally the type of error that you get when you forget a ';' in a file that is #included earlier in the code.

Also, this file is short enough, just put it in-post using [code] ...code tags... [/code]

Your Code:

#ifndef _Class_Array_h
#define _Class_Array_h


template <class T>
class Array
{
private:
	T** arr;
	int lgcSize,phsSize;
public:
	Array(int size);
	Array(const Array& arr);
	~Array();

	const Array& operator=(const Array& other);
	const Array& operator+=(const T& t);
	T& operator[](int index);
	

	friend ostream& operator<<(ostream& out,const Array& arr);
};

#endif //_Class_Array_h

Edited 6 Years Ago by Fbody: n/a

make sure the *.cpp file includes fstream before class_array.h and add std:: friend std::ostream& operator<<(std::ostream& out,const Array& arr);

:$ *smacks head*

Oh yeah... how did I miss the ostream references?

You'll want to consider adding #include <iostream> to the top of the header at a minimum, you may need/want another as well. Also, as AD said, you'll want to resolve the std namespace somehow, either directly or with a using statement.

This article has been dead for over six months. Start a new discussion instead.