Question: Implement the automobile.cpp class below Automobile.hpp #pragma once #include #include class Automobile { friend bool operator==( const Automobile& lhs, const Automobile& rhs ); friend std::ostream
Implement the automobile.cpp class below
Automobile.hpp
| #pragma once | |
| #include | |
| #include | |
| class Automobile { | |
| friend bool operator==( const Automobile& lhs, const Automobile& rhs ); | |
| friend std::ostream & operator<<( std::ostream& stream, const Automobile& vehicle ); | |
| private: | |
| std::string color_; | |
| std::string brand_; | |
| std::string model_; | |
| std::string plateNumber_; | |
| public: | |
| Automobile( const std::string & color, | |
| const std::string & brand, | |
| const std::string & model, | |
| const std::string & plateNumber ); | |
| }; | |
| bool operator!=( const Automobile& lhs, const Automobile& rhs ); |
Automobile.cpp
| #include | |
| #include | |
| #include "Automobile.hpp" | |
| /******************************************************************************* | |
| ** Member function definitions | |
| *******************************************************************************/ | |
| Automobile::Automobile( const std::string & color, | |
| const std::string & brand, | |
| const std::string & model, | |
| const std::string & plateNumber ) | |
| : color_(color), brand_(brand), model_(model), plateNumber_(plateNumber) | |
| {} | |
| /******************************************************************************* | |
| ** Non-member function definitions | |
| *******************************************************************************/ | |
| bool operator==( const Automobile& lhs, const Automobile& rhs ) { | |
| /// To be completed: | |
| /// Return true if each attribute of the left hand side (lhs) is | |
| /// equal to the right hand side (rhs) | |
| . . . | |
| /// | |
| } | |
| bool operator!=( const Automobile& lhs, const Automobile& rhs ) | |
| { return !( lhs == rhs ); } | |
| std::ostream & operator<<( std::ostream& stream, const Automobile& vehicle ) | |
| { | |
| /// To be completed: | |
| /// Insert the vehicle's color, brand, model, and license plate number into the stream, then return the stream | |
| . . . | |
| /// | |
| } |
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
