Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Write a program that sets up a base class Sailor containing protected data for name, rank, and serial number. There should be two constructor

4. Write a program that sets up a base class Sailor containing protected data for name, rank, and serial number. There should be two constructor functions: one is empty and the other has the three data values as inputs. The other member functions should include a GetInfo function (asks the user for Sailor information) as well as a WriteInfo (writes all the Sailor data to the screen). Next derive a new class from Sailor. The Sailor_At_Sea class has the name of the ship to which the Sailor has been assigned, as well as the name of the ship's home port. The Sailor_At_Sea class also has two constructor functions: one that does nothing and the other that receives all the possible Sailor data. This derived class constructor passes the sailor data to the base class constructor. There are also WriteInfo and GetInfo functions that call the associated Sailor functions before handling the derived class specific data. The main function has several steps. 1. Initially it should declare one Sailor and one Sailor_At_Sea objects. Simply make up all the data and pass it into the objects when they are created. 2. Call the WriteInfo functions and verify that the objects were created with the data you passed into them. 3. Next, change the information in both objects by calling the GetInfo functions, and then call

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

1. Signs and symbols of the map Briefly by box ?

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago