Function Overloadin
#include<iostream>;
using namespace std;
class ABC {
public:
void Sum() {
cout << "1 Sum=" << 10 + 20 << endl;
}
void Sum(int a, int b, int c) {
cout << "2 Sum=" << a + b + c << endl;
}
void Sum(float a, int b, int c) {
cout << "3 Sum=" << a + b + c << endl;
}
};
int main() {
float f = 12.0;
ABC obj;
obj.Sum();
obj.Sum(11, 34, 45);
obj.Sum(f, 34, 45);
return 0;
}
Comments
Post a Comment