Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- class Animal{
- public:
- Animal(string aname, string asex, int aage, bool asociable, bool apatronage){
- cout <<"This is the default constructor"<<endl;
- name = aname;
- sex = asex;
- age = aage;
- sociable = asociable;
- patronage = apatronage;
- }
- ~Animal(){
- cout<< "This is a destructor";
- }
- void display(){
- cout<<"The name of the animal is: " <<name <<endl;
- cout<<"The sex of the animal is: " <<sex <<endl;
- cout<<"The age of the animal is: " <<age <<endl;
- cout<<"The animal is sociable : " <<sociable <<endl;
- cout<<"The animal is patronaged: " <<patronage <<endl;
- }
- private:
- //data of the animal
- string name;
- string sex;
- int age;
- bool sociable;
- bool patronage;
- };
- int main(){
- Animal a("Curro", "Male", 2, true, false);
- a.display();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement