Created
January 17, 2017 15:52
-
-
Save gabrielcesar/ae297c05ff0dcada0247f2cf7f60519f 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
/* | |
* 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