P
Peter Hagenaar
Hello there.
I have a question about a virtual template class.
The class wich derives from this class overrides a virtual method in
this template base class and calls the same method in this base class.
Unfortunately, the baseclass method gets called but the preceding code
in the derived class isn't. Mind you you that the base class is a
template class.
Does anybody of you have an idea why this isn't working?
Thanks in advance. (There is a code example end the end of this message)
- Peter Hagenaar
Code example:
I've created a virtual template class of the form:
template<class T>
class BaseClass
{
public:
virtual void DoStuff(void)
{
MessageBox("C++ BaseClass");
};
T MyVar;
};
and a derived class of the form:
class DerivedClass : public BaseClass<MyType>
{
public:
virtual void DoStuff(void)
{
BaseClass<MyType>:oStuff(); // this one is called
MessageBox("C++ DerivedClass"); // not executed !
int dummy = 0; // not executed !
dummy += 23456; // not executed !
};
};
I have a question about a virtual template class.
The class wich derives from this class overrides a virtual method in
this template base class and calls the same method in this base class.
Unfortunately, the baseclass method gets called but the preceding code
in the derived class isn't. Mind you you that the base class is a
template class.
Does anybody of you have an idea why this isn't working?
Thanks in advance. (There is a code example end the end of this message)
- Peter Hagenaar
Code example:
I've created a virtual template class of the form:
template<class T>
class BaseClass
{
public:
virtual void DoStuff(void)
{
MessageBox("C++ BaseClass");
};
T MyVar;
};
and a derived class of the form:
class DerivedClass : public BaseClass<MyType>
{
public:
virtual void DoStuff(void)
{
BaseClass<MyType>:oStuff(); // this one is called
MessageBox("C++ DerivedClass"); // not executed !
int dummy = 0; // not executed !
dummy += 23456; // not executed !
};
};