Question
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started