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

Question #186123

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.


1
Expert's answer
2021-04-29T05:41:14-0400

The given case is the example of polymorphism in C++ programming language. It comes under the object oriented programming approach (OOPS). Polymorphism allows for a data to be available in different formats. For example, vehicle can be used to carry passengers, carrying goods or just for driving on plane roads. The same addition function can be used to add two integers, two floats or one int and one float. Similarly the the case of a women who is customer in the market, mother or sister in house and teacher in the class room. The related overload function are then invoked by comparing and matching the type of variable arguments. This is known at the compile time and appropriate function is selected to perform the desired operation.


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