Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The class Athlete represents a sport fanatic with the data fields name (a string such as Howard) and a sport (such as Rowing). Consider the

The class Athlete represents a sport fanatic with the data fields name (a string such as "Howard") and a sport (such as "Rowing"). Consider the following:

#include class Athlete { public: Athlete( std::string name, std::string sport);

virtual void play( ); private: std::string mName, mSport; }; Athlete::Athlete( std::string name, std::string sport ) : mName( name ), mSport( sport ) { // empty... } void Athlete::play( ) { std::cout << mName << " is playing " << mSport << std::endl; }

Based on this class Athlete, create the class Rower. An Rower is a special kind of Athlete. Driver code should be able to create a Rower by just passing a name to the constructor, as in: Rower r( "Howard" ); . Be sure to Rower calls the parent class constructor, passing "Rowing" as the sport. Define the operation Rower::play( ) so that Rower's print "Ready All Row!" whenever they play.

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

Explain the purpose of a business plan.

Answered: 1 week ago

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago