If you have the following class definitions, which of the following is the proper way to construct an object of the derived class?

class Pet
{
public:
Pet();
void printPet();
string getName();
void setName(string newName);
private:
string name;
};

class Dog:public Pet
{
public:
Dog();
void printPet();
void setType(string newType);
string getType();
private:
string type;
};
a. Dog::Dog():Pet(),type("MUTT")
{
}
b. Dog::Dog()
{
name="Rover";
}
c. Pet::Dog():Pet(),type("MUTT")
{
}
d. Dog::Pet():Pet(),type("MUTT")
{
}


a. Dog::Dog():Pet(),type("MUTT")
{
}

Computer Science & Information Technology

You might also like to view...

In the OpenOffice Gallery, you can mouse over clip art to see its description or name in a pop-up ScreenTip

Indicate whether the statement is true or false

Computer Science & Information Technology

Task Scheduler enables you to set a time to run which of the following maintenance tasks?

A) Remove programs B) Spyware update C) Backup D) Install programs

Computer Science & Information Technology

In Outline view, each sentence is treated as a separate topic or level in the outline

Indicate whether the statement is true or false

Computer Science & Information Technology

A user ____ consists of items that help users interact with a program.

A. interface B. animation C. application D. document

Computer Science & Information Technology