Created
April 25, 2017 05:47
-
-
Save loganintech/e25ccbdd53c6f5077a06c661359a3198 to your computer and use it in GitHub Desktop.
This file contains 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 <string> | |
#include <cstdlib> | |
#include <iostream> | |
using namespace std; | |
class Animal { | |
private: | |
string name; | |
public: | |
Animal(const string); | |
void set_name(const string); | |
string get_name() const; | |
}; | |
Animal::Animal(const string name){ | |
this->name = name; | |
} | |
void Animal::set_name(const string name){ | |
this->name = name; | |
} | |
string Animal::get_name() const{ | |
return this->name; | |
} | |
int main(){ | |
Animal the_animal("Hoe"); | |
cout << the_animal.get_name() << endl; | |
the_animal.set_name("Less Hoe"); | |
cout << the_animal.get_name() << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment