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
Answer:
_____bool__________m_isFriendly; // true if friendly
cout << ____________jessie.getName()_________________ << endl;
if ( _____________jessie.getIsFriendly()_________________ )
cout << \"You can pet me!\" << endl;
