I have two classes, the second inheriting from the first, like follows:
class Tuu_file
{
public:
Tuu_file(){}
virtual ~Tuu_file(){}
virtual void Function(){
cout<<"Tuu_file::Function() run.";}
};
class Tuu_complex_fileublic Tuu_file
{
public:
Tuu_complex_file(){}
virtual ~Tuu_complex_file(){}
virtual void Function(){
cout<<"Tuu_complex_file::Function() run.";}
};
I place a series of Tuu_complex_file objects into a list<Tuu_file>.
When I iterate through the objects in the list & call Function() on them, I would expect to see the output from Tuu_complex_file::Function(). Instead I get the output from Tuu_file::Function.
Does anyone know where I'm going wrong?
Would making my list a list to Tuu_file pointers allow me to use the inherited function?
Cheers,
Douglas JL Common sense is what tells you the world is flat.
class Tuu_file
{
public:
Tuu_file(){}
virtual ~Tuu_file(){}
virtual void Function(){
cout<<"Tuu_file::Function() run.";}
};
class Tuu_complex_fileublic Tuu_file
{
public:
Tuu_complex_file(){}
virtual ~Tuu_complex_file(){}
virtual void Function(){
cout<<"Tuu_complex_file::Function() run.";}
};
I place a series of Tuu_complex_file objects into a list<Tuu_file>.
When I iterate through the objects in the list & call Function() on them, I would expect to see the output from Tuu_complex_file::Function(). Instead I get the output from Tuu_file::Function.
Does anyone know where I'm going wrong?
Would making my list a list to Tuu_file pointers allow me to use the inherited function?
Cheers,
Douglas JL Common sense is what tells you the world is flat.