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...
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...
#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
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.