A Mermaid is half fish and half human. It has upper human body and lower fish body. When under water its upper part swims like a human while its lower part swims like a fish. Please explain how can it swim like a human and a fish at the same time? Create C++ program using class(es) and OOP paradigm to solve this problem.Note: I don't want the actual code but instead I wanna know the OOP Concepts that can be be used to solve this problem (like multiple inheritance, Composition & Aggregation, Overriding etc...) and why?The question is how can we make a class Mermaid that depicts both human and fish functionality on upper and lower parts of its body (like Inheriting the properties of human and fish on the upper & lower parts of the body respectively). I don't need to know how the functionality would be performed.... Instead the concepts required to satisfy those properties (like swimming like humans and fish at the same time). So forget about the physics part. And as far as the content goes I just copy pasted the question from the OOP paper.An example It might be the answer actually Just an example try: Class Human{ /*some data members go here */ public: void swim(){ /*functionality */ } }; Class Fish{/*some data members go here */ public: void swim(){ /*functionality */ } };Class Mermaid:public Human, public Fish{ /*some data members go here */public: void someFunction(){ /*functionality */ } };   
Mermaid problem (OOP)
object oriented;c++;object oriented design
A Mermaid is neither a human nor a fish, so I would not try to shoehorn these classes into an inheritance hierarchy: Class Mermaid{/*some data members go here */ public: void swim() { /*functionality */ } };Implement swim as you like. If you want to reuse some code in all 3 implementations of swim, you could easily do this by creating a fourth class like SwimTools where you can place that code.Of course, you might consider to create an interface class ISwimmer with an abstract swim method and derive Human, Fish, and Mermaid from that class. If you do this should depend on having a practical requirement of dealing with those three classes uniformly.In C++, you can also combine interface inheritance with implementation inheritance, name the base class Swimmer and put the reusable parts there instead of using a separate SwimTools class (however, it is debatable if that is a better or worse design).