B
BCC
Hi,
A colleague has some code like this:
class CMyObject {
// Bunch of Member functions
}
class CMyObjectList: public std::vector<CMyObject>
{
// Bunch of member functions
}
I need to inherit the functionality of his object and list as well as add
some of my own:
class CMyPersonalObject: public CMyObject
{
// More stuff
}
class CMyPersonalObjectList: public CMyObjectList
{
// More stuff
}
But if I pass in CMyPersonalObjectList to a function, and then try to assign
the CMyPersonalObject to a local variable of that type, I get a compiler
error telling me that I cannot convert CMyObject to CMyPersonalObject... the
compiler thinks the list I passed in is made of the parent objects.
What is going on and how do I fix it?
Thanks,
B
A colleague has some code like this:
class CMyObject {
// Bunch of Member functions
}
class CMyObjectList: public std::vector<CMyObject>
{
// Bunch of member functions
}
I need to inherit the functionality of his object and list as well as add
some of my own:
class CMyPersonalObject: public CMyObject
{
// More stuff
}
class CMyPersonalObjectList: public CMyObjectList
{
// More stuff
}
But if I pass in CMyPersonalObjectList to a function, and then try to assign
the CMyPersonalObject to a local variable of that type, I get a compiler
error telling me that I cannot convert CMyObject to CMyPersonalObject... the
compiler thinks the list I passed in is made of the parent objects.
What is going on and how do I fix it?
Thanks,
B