Question: Consider the following code snippet: class Home { public: Home ( ) ; virtual void set _ address ( string new _ address ) ;
Consider the following code snippet:
class Home
public:
Home;
virtual void setaddressstring newaddress;
private:
string address;
string landmark;
;
Home::Home
address ;
landmark ;
void Home::setaddressstring newaddress
cout "Home : setaddress function" endl;
class Villa : public Home
public:
Villa;
void setaddressstring newaddress;
;
Villa::Villa
void Villa::setaddressstring newaddress
cout "Villa : setaddress function" endl;
int main
Home q new Home;
Villa cq new Villa;
q cq;
qsetaddressWhich function?";
return ;
Which of the following is true about the statement qsetaddressWhich function?";
Question options:
Home::setaddressstring newaddress is called by q which then calls Villa::setaddressstring newaddress
Villa::setaddressstring newaddress is called by q which then calls Home::setaddressstring newaddress
Home::setaddressstring newaddress is called by q
Villa::setaddressstring newaddress is called by q
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
