Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Debug the pet.h file and pet.cpp file #ifnotdef PET_H #then_define PET_H #include using name space std namespace ttopsls { Class Pet { public Pet(); void

Debug the pet.h file and pet.cpp file

#ifnotdef PET_H #then_define PET_H #include

using name space std

namespace ttopsls

{

Class Pet

{

public

Pet();

void setName(string name); string getName() const; void setAge(double age); int getAge() const; virtual void talk();

private:

string _name; int _age;

};

class Dog::public Pet

{

public:

Dog();

void setBreed(string breed); string getBreed() const;

private:

string _breed;

}

class Cat:Pet

{

Public:

Cat();

void setColor(string color); string getColor() const;

private:

string _color;

};

};

#endif

The above is pet.h file and the following is the file pet.cpp

#include #include

using name space std namespace fhsuzeng

{

void Pet::Pet():: _name("no name yet"), _age(0){} int Pet::getAge() const { return age; }

void Pet::setAge(int age) { age = age; } string Pet::getName() const { return _name }

void Pet::setName(string name) { _name = name; } Pet::Dog(): Pet(), _breed("Any breed") {} string Dog::getBreed() { return _breed; }

void Dog::setBreed(string breed) { _breed = breed; } Cat::Cat(): Pet(), _color("Red")

Cat::string getColor() const { return _color; }

void Cat:: setColor(string color) { _color = color; }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions

Question

Name two vital conditions of a perfect gas.

Answered: 1 week ago