Skip to content

Instantly share code, notes, and snippets.

@ichtrojan
Created September 30, 2018 14:36
Show Gist options
  • Save ichtrojan/6728f8306b0dc9160bfcc04c7da102a7 to your computer and use it in GitHub Desktop.
Save ichtrojan/6728f8306b0dc9160bfcc04c7da102a7 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class human {
public:
string name;
int age;
void eat () {
cout << name <<" is eating" << endl;
}
void eat (string food1) {
cout << name <<" is eating "<< food1 << endl;
}
void eat (string food1, string food2) {
cout << name <<" is eating "<< food1 << " and " << food2 << endl;
}
};
int main () {
human exhibitA;
exhibitA.name = "Michael";
exhibitA.eat();
exhibitA.eat("Rice");
exhibitA.eat("Rice", "Beans");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment