Created
October 19, 2017 14:09
-
-
Save tswann/38047a632265cc7d8b2315459818886d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include <string> | |
using namespace std; | |
class Overloaderer | |
{ | |
public: | |
void myFunction(std::string something) | |
{ | |
cout << “Do something stringy: “ << something << endl; | |
} | |
void myFunction(int num) | |
{ | |
cout << “Do something octal: “ << std::oct << num << endl; | |
} | |
void myFunction(float num) | |
{ | |
cout << “Do something floaty: “ << std::fixed << std::setprecision(2) << num << endl; | |
} | |
}; | |
int main(void) | |
{ | |
Overloaderer overload; | |
overload.myFunction(“What about ye”); | |
overload.myFunction(8); | |
overload.myFunction(3.14159f); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment