J
joe
I expected this to work:
class Base
{
virtual void go(int *) {cout<<"BASE CLASS"<<endl;}
};
class Derived : public Base
{
template<typename T>
void go(T*) {cout<<"Derived Class"<<endl;}
};
int main(){
Base *b = new Derived;
b->go(new int[30]);
}
I get "BASE CLASS". I expected the virtual function to work and find
the derived class function.
What's the nitty gritty here of what's going on?
class Base
{
virtual void go(int *) {cout<<"BASE CLASS"<<endl;}
};
class Derived : public Base
{
template<typename T>
void go(T*) {cout<<"Derived Class"<<endl;}
};
int main(){
Base *b = new Derived;
b->go(new int[30]);
}
I get "BASE CLASS". I expected the virtual function to work and find
the derived class function.
What's the nitty gritty here of what's going on?