Assume I have two classes

```
class A{
    /*with some attributes and methods*/
};

class B{
    /*with some other attributes and methods*/
};

```

My problem
----------

I would like to have two things that seems to be mutually exclusive... 

* `B` becomes a child of `A`. So I want to declare `class B:public A`.

But if I do that, `B` contains only "one set" of attributes of `A`

```
class B:public A{
    /*with some attributes and methods*/
};

```

* `B` has `N` different instances (an array) of `A`.

But if I do that, `B` doesn't know the method contained in `A` and I loose the class hierarchy I need. 

```
class B{
    /*with some attributes and methods*/
    private:
        A* a;
        unsigned int N; /*number of instances A*/
};

```

I could of course combine the two, but this doesn't seem a good idea because `B` will contain `N+1` instances `A`. I mean by `+1` that all the arguments contained in `A` will be inherited in `B`.

Is there an elegant way to combine my two requirements?