Skip to content

Instantly share code, notes, and snippets.

@tswann
Created October 19, 2017 14:09
Show Gist options
  • Save tswann/38047a632265cc7d8b2315459818886d to your computer and use it in GitHub Desktop.
Save tswann/38047a632265cc7d8b2315459818886d to your computer and use it in GitHub Desktop.
#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