Question
Given the following class. Assume that all the provided functions are fully implemented. Overload the operators >> and < < so they can directly work
Given the following class. Assume that all the provided functions are fully implemented. Overload the operators >> and << so they can directly work with the class. Make sure to write the full code for the operators, not just the prototypes. (4 points for each operator)
class Train {
int makeyear;
float maxspeed;
public:
Train(); // default contructor
Train(int myyear, float myspeed); // overloaded constructor
void read(std::istream& is); // function that reads train information
void display(std::ostream& os) const; // function that displays the train information
};
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