Answer to Question #189690 in C++ for Create a class nam

Question #189690

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 


1
Expert's answer
2021-05-06T02:12:59-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS