+ 1

How to use function overloading

Show with example like coding

28th Jul 2017, 6:15 AM
TOSHIF CHHIPA
TOSHIF CHHIPA - avatar
3 odpowiedzi
+ 1
In which language ?
28th Jul 2017, 6:27 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
C++
28th Jul 2017, 6:32 AM
TOSHIF CHHIPA
TOSHIF CHHIPA - avatar
0
#include <iostream> using namespace std; class printData { public: void print(int i) { cout << "Printing int: " << i << endl; } void print(double f) { cout << "Printing float: " << f << endl; } void print(char* c) { cout << "Printing character: " << c << endl; } }; int main(void) { printData pd; // Call print to print integer pd.print(5); // Call print to print float pd.print(500.263); // Call print to print character pd.print("Hello C++"); return 0; } i took it from https://www.tutorialspoint.com you can look at the site when you are struggling.
28th Jul 2017, 7:49 AM
Yusuf Saylam
Yusuf Saylam - avatar