2. A Transportation hierarchy : For each of the classes below you…
Question Answered step-by-step 2. A Transportation hierarchy : For each of the classes below you… 2. A Transportation hierarchy : For each of the classes below you should provide sufficient functionality to test your understanding of the relationships between the classes. You should, in particular,see how you can use constructors across classes. The code should be able to compile but you don’tneed to store data or have other within each class at this point.(a) Define a base class Transportation.(b) Define three derived classes, SeaTransport, LandTransport, and AirTransport.(c) Inheritance can occur across multiple levels. Define Car and Canoe as classes derived from appropriate classes. (d) It’s possible to have multiple inheritance in C++. Define Hovercraft as derived from two appropriate classes. 3. This involves extending the Transportation hierarchy set up above. (a) Now add some data elements and member functions to support the hierarchy. (b) Make Transportation an abstract class by adding an appropriate display() function. (c) Make a collection that could contain various different forms of transport. Set different elements of the collection to refer to a range of different forms of transport. (d) You can add in additional types of transport if you like. (e) Illustrate the polymorphism present in the use of the display() function. (f) What is the diamond problem. Explore how you deal with that problem in the context of the HoverCraft? Computer Science Engineering & Technology C++ Programming CSCI 251 Share QuestionEmailCopy link Comments (0)


