Skip to content

Instantly share code, notes, and snippets.

@gabrielcesar
Created January 17, 2017 15:52
Show Gist options
  • Save gabrielcesar/ae297c05ff0dcada0247f2cf7f60519f to your computer and use it in GitHub Desktop.
Save gabrielcesar/ae297c05ff0dcada0247f2cf7f60519f to your computer and use it in GitHub Desktop.
/*
* Method Overloading
*/
#include <iostream>
using namespace std;
class Soma
{
public:
int sum ( int a, int b )
{
return a + b;
}
int sum ( int a, int b, int c )
{
return a + b + c;
}
};
int main ( void )
{
Soma soma;
cout << soma.sum ( 10, 20 ) << endl;
cout << soma.sum ( 10, 20, 30 ) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment