1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
using namespace std;
template <class T, class U, class V>
T mult(T a, U b){return (a*b);}//worked fine
template <class T, class U, class V>
T mult(T a, U b, V c){return ((a*b)*c);}//worked fine
template <class T, class U, class V, class W>
T mult(T a, U b, V c, W d){return (((a*b)*c)*d);}//compiler is'nt complaining about this
int main()
{
double i;
cout << mult(2,2)//compiler now says no matching function
<< "\t"
<< mult(0.5,2,0.5)//this still works fine
<< endl;
return 0;
}
|