1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
attashe74 [19]
3 years ago
15

Write a copy assignment operator for CarCounter that assigns objToCopy.carCount to the new objects's carCount, then returns *thi

s. Sample output for the given program:
Cars counted: 12
#include
using namespace std;

class CarCounter {
public:
CarCounter();
CarCounter& operator=(const CarCounter& objToCopy);
void SetCarCount(const int setVal) {
carCount = setVal;
}
int GetCarCount() const {
return carCount;
}
private:
int carCount;
};

CarCounter::CarCounter() {
carCount = 0;
return;
}

// FIXME write copy assignment operator

/* Your solution goes here */

int main() {
CarCounter frontParkingLot;
CarCounter backParkingLot;

frontParkingLot.SetCarCount(12);
backParkingLot = frontParkingLot;

cout << "Cars counted: " << backParkingLot.GetCarCount();

return 0;
}
Computers and Technology
1 answer:
Olin [163]3 years ago
5 0

The following cose will be used to copy assignment operator for CarCounter

<u>Explanation:</u>

Complete Program:

#include <iostream>

using namespace std;

class CarCounter

{

public:

CarCounter();

CarCounter& operator=(const CarCounter& objToCopy);

void SetCarCount(const int setVal)

{

 carCount = setVal;

}

int GetCarCount() const

{

 return carCount;

}

private:

int carCount;

};

CarCounter::CarCounter()

{

carCount = 0;

return;

}

// FIXME write copy assignment operator

/* Your solution goes here */

CarCounter& CarCounter::operator=(const CarCounter& objToCopy)

{

if(this != &objToCopy)

 carCount = objToCopy.carCount;

return *this;

}

int main()

{

CarCounter frontParkingLot;

CarCounter backParkingLot;

frontParkingLot.SetCarCount(12);

backParkingLot = frontParkingLot;

cout << "Cars counted: " << backParkingLot.GetCarCount();

cout << endl << endl;

system("pause");

return 0;

}

You might be interested in
Hey does anybody know how to delete history on a school-issued chrome book, I tried to delete it but it won't let you clear your
satela [25.4K]

Answer:

You have to log in to your google account. BRAINLIEST PLEASE

Explanation:

5 0
3 years ago
3. Find the product of (a² +3a+5) x (a+7)​
sergij07 [2.7K]

Explanation:

(a^2 + 3a +5) × (a + 7)

= a^3 + 7a^2 + 3a^2 + 21a + 5a + 35

= a^3 + 10a^2 + 26a + 35

3 0
4 years ago
A technician has been asked to upgrade a processor and needs to do some research. The computer is just a couple of years old. Wh
DanielleElmas [232]

Answer:

The two best options can be processors like inlet i7 4.0 GHZ 8th generation processor, and two popular models are core and Pentium for inlet. Similarly for AMD we have 4 GHZ 8 core AMD processors. And two very popular examples are Athlon and Phenom.

You need to check the Graphics, clock speed etc. as well to end up with the best processor. Also make sure that it is motherboard compatible, and to the motherboard that you are having, If number of core is more and frequency is high, it means Processor is better, and same thing applies for generations as well.

Explanation:

The answer is self explanatory.

6 0
3 years ago
Badin Industries runs a web application that processes e-commerce orders and handles credit card transactions. As such, it is su
Novay_Z [31]

Answer:

The correct option is C.

Explanation:

As Badin Industry is using the Payment Card Industry Data Security Standard (PCI DSS) which required the scan to be be done at least annually if there is no change in the application and when the application is changed.

In this context, provided there is no application change the minimum requirement for the scan is once in the year thus the correct option is C.

7 0
3 years ago
Read 2 more answers
I wiil mark brainlist ​
Darina [25.2K]
CAD is the answer you require, but it may also be Spread sheet

Hope this helped ♥︎
5 0
3 years ago
Other questions:
  • The technology (software) that automatically downloads website information to your computer is called ________.'
    15·1 answer
  • Which is the common name for a program that has no useful purpose, but attempts to spread itself to other systems and often dama
    14·1 answer
  • Which of the following variable declarations is a correct assignment?
    14·1 answer
  • John would like to move from the city into the suburbs and has been saving up a large down payment for a home. Which is the most
    7·1 answer
  • 2. What is an inanimate object? (1.0 points)
    14·1 answer
  • Why must you be careful when handling a hard drive?
    10·1 answer
  • The working window of a presentation is the O outline O handout 0 notes o slide​
    5·2 answers
  • What is the second step when designing an algorithm?
    12·2 answers
  • You want a cable that could be used as a bus segment for your office network. The cable should also be able to support up to 100
    5·1 answer
  • can you still receive messages on messenger from a person when you deleted the conversation with them? (But not blocked them)
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!