Topic: Templates and virtual functions
Author: Roman Lechtchinsky <wolfro@cs.tu-berlin.de>
Date: 1996/04/22 Raw View
Hi,
recently I've asked a question about member templates and virtual functions.
Now, it seems to me that this question is part of larger problem: when does a
member function generated during the instantiation of a template override a
virtual function? Here are some examples ( I've done my best to complicate
the matters :-). Class Base is declared as:
class Base
{
virtual void f(Base);
};
1)
template<class T> class Derived : Base
{
void f(T);
};
2)
template<class T> class Derived : T
{
void f(Base);
};
3)
template<class T> class Derived : T
{
void f(T);
};
In which cases will Derived<Base>::f override Base::f and in which sections
of the DWP are these situations discussed? Is there a general rule? I'd
suggest one if not.
Bye
Roman
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]