nested class fun 
Author Message
 nested class fun

I'm not sure yet if a previous (attempted) post of mine actually made it to
this newsgroup, but I've distilled my problem even further...
Here is my source:

#include <vector>
using namespace std;

class FOO
{
public:
 class BAR
 {
 public:
  BAR(){};
  ~BAR(){};
 protected:
  int m_barData;
 };

 FOO(){};
 virtual ~FOO(){}
protected:
 int m_fooData;
 vector<BAR> m_bars;

Quote:
};

class Doer
{
public:
 Doer(FOO &inFoo)
 {
 };
 ~Doer(){};
protected:
 vector< FOO::BAR > m_someFooBars;

Quote:
};

void main()
{
 FOO theFoo;
 Doer theDoer(theFoo);

Quote:
}

Here is the compiler output:
Compiling...
FooBarTest.cpp
D:\Program Files\DevStudio\VC\INCLUDE\vector(103) : error C2065: 'BAR' :
undeclared identifier
D:\Program Files\DevStudio\VC\INCLUDE\vector(103) : error C2440: 'default
argument' : cannot convert from 'int' to 'const class FOO::BAR &'
                                                                 Reason:
cannot convert from 'int' to 'const class FOO::BAR'
                                                                 No
constructor could take the source type, or constructor overload resolution
was ambiguous
Error executing cl.exe.

FooBarTest.obj - 2 error(s), 0 warning(s)

What is wrong here? Do I not realize some dark secret concerning nested
classes, scope, templates, and/or STL?

Any help would be appreciated!
Thanks!
Dave Englund



Mon, 16 Apr 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Fun Fun Fun

2. Using unmanaged nested classes of a managed class

3. call from nested class method nonstatic of the class containing

4. Performance of stuct and class definitions nested in a class definition

5. nested class in class template

6. Addressing to members of surrounding class from nested class

7. raising event from a nested class

8. Nested Class and protection

9. BUG: Managed C++ Explicit Interface Implementations on Nested Classes

10. class in Nested namespaces using WebService !arrrghhh

11. nested class throw TypeLoadException

12. Nested Classes...

 

 
Powered by phpBB® Forum Software