#include <iostream>
using namespace std;
class Multiply{
public:
double operator()(double x, double y) const {return x*y;}
double operator()(double x, int y) const {return x*y;}
double operator()(int x, double y) const {return x*y;}
int operator()(int x, int y) const {return x*y;}
};
int main()
{
Multiply multiply;
cout << " 3.6 * 7 = " << multiply(3.6,7) << endl;
cout << " 3 * 7 = " << multiply(3,7) << endl;
return 0;
}
网友评论