I have one template function which will take a pointer type and i have instantiated it before calling. i have written function with its dummy implementation as follows:
template<T>fun_name( const T *p )
{
//written functionality which will give me class name that i will store into string Variable
e.g. i got output like this string Var = "First_class" or string Var = "Second_class"
//Using this class name i will call one function of that class
if(Var == "Fisrt_class")
{
First_class::static_function_name(p);
}
if(Var == "Second_class")
{
Second_class::static_function_name(p);
}
}
在全球范围,对以下两种变数即时履行这一职能:
template<first_class>static_function_name(const First_class *)
template<Second_class>static_function_name(const Second_class *)
以上法典给我留下的错误是:
error: no matching function call in Second_class::static_function_class(const Fisrt_class*)
error: no matching function call in First_class::static_function_class(const Second_class*)
页: 1