Skip to content

Instantly share code, notes, and snippets.

@loganintech
Created April 25, 2017 05:47
Show Gist options
  • Save loganintech/e25ccbdd53c6f5077a06c661359a3198 to your computer and use it in GitHub Desktop.
Save loganintech/e25ccbdd53c6f5077a06c661359a3198 to your computer and use it in GitHub Desktop.
#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