Completion Fill in the blanks from the implementation of a D

Completion

Fill in the blanks from the implementation of a Dog class:

class Dog {

________________________________

void setName( string name );

void setOwner( string owner );

void setIsFriendly( bool isFriendly );

string getName() const;

string getOwner() const;

bool getIsFriendly() const;

________________________________

string m_name; // dog\'s name

string m_owner; // owner\'s name

_______________m_isFriendly; // true if friendly

};

In my main function, I create a Dog object named jessie and use the \"set\"

methods to initialize jessie\'s variables. Complete the following code to print

jessie\'s name and, if she is friendly, print the message \"You can pet me!\":

cout << _____________________________ << endl;

if ( ______________________________ )

cout << \"You can pet me!\" << endl;

Solution

_______________m_isFriendly; // true if friendly

Since the above variable holds true and false that should be bool.

So answer is

bool m_isFriendly;

cout << _____________________________ << endl;

There is one method getName() which can return pet name so the answer is

jessie.getName()

if(jessie.getIsFriendly() == true)

Completion Fill in the blanks from the implementation of a Dog class: class Dog { ________________________________ void setName( string name ); void setOwner( s

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site