Question: *** In C++ *** Use the Ship class below and derive a Cargo and Cruise ship class from the ship class IAW chapter 15 Programming
*** In C++ ***



Use the Ship class below and derive a Cargo and Cruise ship class from the ship class IAW chapter 15 Programming Challenges #12 on page 985 of the text. The ship classes should be declared in a separate header file. Demonstrate the class with a program (shown below): int main() { // Create an array of Ship pointers, initialized with the addresses of 3 dynamically allocated objects. Ship *ships[3] = { new Ship("Lolipop", "1960"), new Cruise Ship("Disney Magic", "1998", 2400), new CargoShip("Black Pearl", "1800", 50000) }; // Call each object's print function. for (int index=0; index print(); cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
