Answer to Question #186525 in C++ for Aditya Pandey

Question #186525

A lady behaves like a teacher in a classroom, mother or daughter in a home and 

customer in a market. Here, a single person is behaving differently according to the 

situations. Consider a above real-life example and which concept you will use in cpp. 

Elaborate the concept.Explain in theory.


1
Expert's answer
2021-04-28T16:49:21-0400
#include <iostream>    
using namespace std;    
class Lady {    
    public:    
void info(){      
cout<<"personal information:...";      
    }        
};     
class Teacher: public Lady
{      
 public:    
 void info()      
    {           cout<<"Personal information: teaching physics...";      
    }      
};    
class Mother: public Lady
{      
 public:    
 void info()      
    {           cout<<"Personal information: Mother...";      
    }      
};  
class Customer: public Lady
{      
 public:    
 void info()      
    {           cout<<"Personal information: buying...";      
    }      
};  

int main(void) {    
Customer c = Customer();      
   c.info();    
   return 0;    
} 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS