Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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