Question: #include using namespace std; class CarParkingSpot { public: CarParkingSpot ( ) ; CarParkingSpot ( const CarParkingSpot& origCarParkingSpot ) ; void SetParkingSpot ( const int spot

#include
using namespace std;
class CarParkingSpot {
public:
CarParkingSpot();
CarParkingSpot(const CarParkingSpot& origCarParkingSpot);
void SetParkingSpot(const int spot){
*parkingSpot = spot;
}
int GetParkingSpot() const {
return *parkingSpot;
}
private:
int* parkingSpot;
};
CarParkingSpot::CarParkingSpot(){
parkingSpot = new int;
*parkingSpot =0;
}
// FIXME add copy constructor
/* Your solution goes here */
void ParkingSpotPrinter(CarParkingSpot carParkSpot){
cout << "Parking Spot: "<< carParkSpot.GetParkingSpot();
}
int main(){
CarParkingSpot carParkingSpot;
int spot;
cin >> spot;
carParkingSpot.SetParkingSpot(spot);
ParkingSpotPrinter(carParkingSpot);
return 0;
}
#include
using namespace std;
class CarParkingSpot {
public:
CarParkingSpot();
CarParkingSpot(const CarParkingSpot& origCarParkingSpot);
void SetParkingSpot(const int spot){
*parkingSpot = spot;
}
int GetParkingSpot() const {
return *parkingSpot;
}
private:
int* parkingSpot;
};
CarParkingSpot::CarParkingSpot(){
parkingSpot = new int;
*parkingSpot =0;
}
// FIXME add copy constructor
/* Your solution goes here */
void ParkingSpotPrinter(CarParkingSpot carParkSpot){
cout << "Parking Spot: "<< carParkSpot.GetParkingSpot();
}
int main(){
CarParkingSpot carParkingSpot;
int spot;
cin >> spot;
carParkingSpot.SetParkingSpot(spot);
ParkingSpotPrinter(carParkingSpot);
return 0;
}

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!