hi, i need to write a subclass for the Dog Class. I have no idea how to go about it. I need help?
I need to write a subclass of Dog named Lab that has an additional attribute of color which can be either YELLOW, CHOCOLATE, WHITE, or BLACK for a given dog. Also, write get and set functions for that attribute.
THis is the dog class:
#include <iostream>
#include <string>
using namespace std;
class Dog
{protected:
string name;
char gender;
public:
Dog(string theName, char theGender)
{ name= theName;
gender= theGender;
}
~Dog() {cout <<"good bye:" << name <<endl;}
void bark(int n)
{cout<<name<<":";
for(int i=1; i<=n; i++) cout << "rff"<<endl;
}
void sleep()
{ cout <<name<<":zzzz, zzzz" << endl;}
void eat()
{cout << name <<": slurp" << endl;}
}
please help asap
I need to write a subclass of Dog named Lab that has an additional attribute of color which can be either YELLOW, CHOCOLATE, WHITE, or BLACK for a given dog. Also, write get and set functions for that attribute.
THis is the dog class:
#include <iostream>
#include <string>
using namespace std;
class Dog
{protected:
string name;
char gender;
public:
Dog(string theName, char theGender)
{ name= theName;
gender= theGender;
}
~Dog() {cout <<"good bye:" << name <<endl;}
void bark(int n)
{cout<<name<<":";
for(int i=1; i<=n; i++) cout << "rff"<<endl;
}
void sleep()
{ cout <<name<<":zzzz, zzzz" << endl;}
void eat()
{cout << name <<": slurp" << endl;}
}
please help asap