If I have a class hierarchy as follows:
class barBase
{
};
class barDerived:publ ic barBase
{
};
class fooBase
{
};
class fooBarDerived:p ublic fooBase, barDerived
{
};
And if I create an instance as follows:
fooBase* myFooBase = new fooBase;
Is there any way I can then cast myFooBase to a barBase, without
knowing about fooBarDerived?
(this code should only know about barBase and fooBase)
barBase* myBarBase = some_cast(myFoo Base);
Intuitively I'd think there ought to be, because myFooBase points to an
object which is, in part, a barBase. But I can't see any way of doing
this.
--
Simon Elliott http://www.ctsn.co.uk
class barBase
{
};
class barDerived:publ ic barBase
{
};
class fooBase
{
};
class fooBarDerived:p ublic fooBase, barDerived
{
};
And if I create an instance as follows:
fooBase* myFooBase = new fooBase;
Is there any way I can then cast myFooBase to a barBase, without
knowing about fooBarDerived?
(this code should only know about barBase and fooBase)
barBase* myBarBase = some_cast(myFoo Base);
Intuitively I'd think there ought to be, because myFooBase points to an
object which is, in part, a barBase. But I can't see any way of doing
this.
--
Simon Elliott http://www.ctsn.co.uk
Comment