Create a class named DogCare. Include fields for a dog’s data (using Dog class from question 1), the date (using Date class from question 4), the time (using Time class
#include <iostream>
using namespace std;
class Dog{
protected:
string dog_name;
};
class Date{
protected:
string date;
};
class Time{
protected:
string time;
};
class DogCare: public Dog, public Date, public Time{
public:
void displayDogInfo(string n, string d, string t){
dog_name=n;
date=d;
time=t;
cout<<"Dog's name: "<<n<<endl;
cout<<"Date: "<<d<<endl;
cout<<"Time: "<<time<<endl;
}
};
int main(){
DogCare d1;
d1.displayDogInfo("Teddy","5/6/2021","12:45");
return 0;
}
Comments
Leave a comment