Child class access in Parent class

Hello,I have parent class and it's child. In the parent class I want to create List of child class objects. How it's possible to do?

e.g.

1
2
3
4
5
6
7
8
9
class GalaxyCluster{
public:
List<Galaxy> *GalaxyList;
};

class Galaxy: public GalaxyCluster{
public:
...
};


In this expamle List<Galaxy> *GalaxyList. Galaxy is undeclared. How I suppose to fix this? :)
Last edited on
This doesn't really make sense. Inheritance implies an "is a" relationship. For example, "Dog" might be derived from "Animal" because a Dog is a animal.

Here you're deriving Galaxy from GalaxyCluster, which implies a Galaxy is a GalaxyCluster (which makes no sense).

You probably don't need to inherit here.
Thx for reply. It makes sense :) I'll try other way
Topic archived. No new replies allowed.