S
Simon Elliott
I want to do something along these lines, but with one crucial
difference:
class foo1
{
public:
foo1(void){}
void Test1(void)
{
i1 = 1;
}
protected:
struct b1
{
int i1;
} bar;
};
class foo2ublic foo1
{
public:
foo2(void){}
void Test2(void)
{
i1 = 1;
i2 = 2;
}
protected:
struct b2ublic b1
{
int i2;
} bar;
};
In the above, there are two instances of bar - foo1::bar and foo2::bar.
I want to do something similar, but with only one instance of bar.
In other words I want foo2 to inherit from and extend the functionality
of foo1, and I want foo2 to contain an extended bar.
So foo1::Test1 would be accessing foo1::bar.i1 and so would foo2::Test2.
I'm fairly sure that this can't be done, but perhaps some of the more
experienced developers here know something I don't!
difference:
class foo1
{
public:
foo1(void){}
void Test1(void)
{
i1 = 1;
}
protected:
struct b1
{
int i1;
} bar;
};
class foo2ublic foo1
{
public:
foo2(void){}
void Test2(void)
{
i1 = 1;
i2 = 2;
}
protected:
struct b2ublic b1
{
int i2;
} bar;
};
In the above, there are two instances of bar - foo1::bar and foo2::bar.
I want to do something similar, but with only one instance of bar.
In other words I want foo2 to inherit from and extend the functionality
of foo1, and I want foo2 to contain an extended bar.
So foo1::Test1 would be accessing foo1::bar.i1 and so would foo2::Test2.
I'm fairly sure that this can't be done, but perhaps some of the more
experienced developers here know something I don't!