hi i am trying to create a class that contains a struct. This struct inherits properties from other classes.

class people
{
public:
struct person:public parent
{
private:
char * data
public:
setdata(char * x)
}

In the parent class i have

class parent
{
private:
public:
person **child
}

my problem is that it does not recognise the person **child to by a type of struct person in the other class. Is there a way to get around this?

Recommended Answers

All 2 Replies

I would define the 'parent' class before the 'people' class, and before 'people' I would add a forward declaration "class person;".

Why do none of your lines have semi colons behind them?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.