高手留步,template是如何工作的,为题解决了,方分
我写了这样的一个函数
bool Input(T & Input)
{
//Use to record the times user had input
int int_Index = 0;
try
{
do
{
cin>>Input;
if (Input>0)
{
return true;
}
else
{
Input = 0;
cout<<endl;
cout<<"You Input a wrong No.Please try Again!"<<endl;
}
}while(++int_Index<3);
return false;
}
catch(string temp)
{
cout<<temp.c_str;
return false;
}
}
在主函数中以如下形式调用
int intTemp;
float fTemp;
bResult = Input(intTemp);//1
bResult = Input(fTemp); //2
这两次调用反汇编得到结果如下
call Input (430FD7h) // 1
call Input (430FAAh)
而00430FD7 jmp Input (434DA0h)
00430FAA jmp Input (435460h)
这样他酒厂深了两个实体,