question regarding templatization of virtual function
- by jan
Hi,
I am new to this forum and sorry If I am repeating this question. I know that you cannot templatize the virtual function and I do understand the concept behind it. But I still need a way to get across some errors I am getting it. I am able to make my stuff work but it doesn't look to me.
Here's the deal,
I have class called System,
#include "Vector.h"
class System
{
virtual void VectorToLocal(Vector<T>& global_dir,const Vector<T>* global_pos = 0) const = 0;
};
class UnresolvedSystem : public System
{
virtual void VectorToLocal(Vector<T>& global_dir,const Vector<T>* global_pos = 0) const
{
//do something
}
};
In Vector.h
tenplate<typename T>
class Vector
{
//some functions
};
See now I want to templatize VectorToLocal in system.h to take just Vector, but I cannot do it as it is a virtual function. I want a work around. I know I can have VectorToLocal take Vector, Vector etc as arguments. But I do not want to do it.
Any help would be really appreciated.
Thanks in advance,
Jan