I have the following declaration in a header file (MyClass.h)
//contents of MyClass.h
class MyClass
{
public:
MyClass()
MyClass(const MyClass&);
...
};
typedef std::vector<MyClass MyClassVect;
typedef MyClassVect::iterator MyClassVectIter;
typedef MyClassVect::const_iterator MyClassVectConstIter;
//Contents of souce file (AnotherFile.cpp)
#include "MyClass.h"
namespace
{
MyClassVector classes ;
classes.push_back(new MyClass()); //syntax error : missing ';' before '.'
.......
}
The type of variable 'classes' is not recognized as a vector (as
specified in the declaration), but rather as an int (i.e. int
'anonymous-namespace'::classes).
question is - how may I use a variable of the types declared in
"MyClass.h" ?