Creating Mutiple Nested Class Instances

I am wondering how to create multiple instances of a nested class within one instance of the outer class.

Here is a simplified version of what I'm doing:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Outer
{
public:
  Outer ();

  void methodA ();

private:
  class Inner
  {
    Inner ();
  };

  std::vector<Inner*> innerList;
};

void
Outer::methodA ()
{
  Inner* innerObj = new Inner (); //doesn't work, says Inner () is inaccessible.
  innerList.push_back (innerObj);
}


How can I go about doing this?
1
2
3
4
5
class Inner
  {
public:
    Inner ();
  };


Inner* innerObj = new Inner () why pointers? (remember to delete them)
Ah! that seems so obvious now. Thanks for the help!
Topic archived. No new replies allowed.