D
DeMarcus
Hi,
I have a function template structure like this.
struct A
{
};
struct B : A
{
}
class SomeClass
{
public:
template<typename T>
void fnc( const T& t )
{
std::cout << "Template" << std::endl;
}
void fnc( const A& a )
{
std::cout << "Non-template" << std::endl;
}
};
int main()
{
SomeClass sc;
sc.fnc( A() ); // This gives me "Non-template".
sc.fnc( B() ); // Error! This gives me "Template"
// even though B inherits from A.
}
What's the proper way making instances of B access the non-templated
function?
Thanks,
Daniel
I have a function template structure like this.
struct A
{
};
struct B : A
{
}
class SomeClass
{
public:
template<typename T>
void fnc( const T& t )
{
std::cout << "Template" << std::endl;
}
void fnc( const A& a )
{
std::cout << "Non-template" << std::endl;
}
};
int main()
{
SomeClass sc;
sc.fnc( A() ); // This gives me "Non-template".
sc.fnc( B() ); // Error! This gives me "Template"
// even though B inherits from A.
}
What's the proper way making instances of B access the non-templated
function?
Thanks,
Daniel