Question: Consider the Base and BaseBall classes defined below. There are two things wrong with this code, both having something do do with the output function

Consider the Base and BaseBall classes defined below. There are two things wrong with this code, both having something do do with the output function(s). What are the problems, and how can they be fixed?
class Base {
public:
virtual void output();
Base() : x("home"), y("plate"), pop(42){}
private:
string x, y;
int pop;
};
class BaseBall: public Base {
public:
void output(){
cout <<"at "<< x <<""<< y <<",";
cout <<" the batter hit the ball "<< pop <<""<< fly << endl;
}
BaseBall() : fly("feet"), Base(){}
private:
string fly;
};

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!