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
I NEED HELP QUICK
Serjik [45]

Answer: keeps confidential documents secure,

displays a GUI, allocates the computer's resources, and retrieves files

Explanation:

The operating system can be defined as the software installed in the system that provides the information and services to the users by controlling the hardware, software resources, and regulates the computer programs. It runs the applications and programs in the system, displays the graphic user interface for the services, stores, manipulates, and retrieves files. It prevents the unauthorized access to the data and programs by using passwords thus provides the security to the system and documents.

8 0
2 years ago
A record is a specific piece of information state true or false​
Alex787 [66]

Explanation:

<h3> I think it is False</h3>

hope it's help

5 0
2 years ago
Which are advantages of using a server operating system?
iogann1982 [59]

Answer:

Extra security features and networking services built right in

Explanation:

The major advantage of using a server operating system is that it has decent security features and networking services built right in it from the default settings

8 0
2 years ago
Wireshark capture files, like the DemoCapturepcap file found in this lab, have a __________ extension, which stands for packet c
VashaNatasha [74]

Answer:

Option (d) is correct

Explanation:

Previously saved capture files can be read using Wireshark. For this, select the File then open the menu. Then Wireshark will pop up the “File Open” dialog box.

Wireshark capture files, like the DemoCapturepcap file found in this lab, have a .pcapng extension, which stands for packet capture, next generation.

5 0
2 years ago
Sendstars is a package delivering company that recently made a study on its customer retention and service renewal metrics. They
masya89 [10]

Answer: C. Cause and Effect Modelling.

Explanation:

Data Mining is a technique which aims at obtaining important and useful information in a stockpile of data. This in turn would prove useful in making predictions. It would also inform present decisions.

The Cause and Effect modelling approach explains that for every given action ( effect ), there was a prompting factor ( cause ).

In the case of Sendstars Company, the downward spiral in customer retention was as a result of ill -mannered staff. This effect, prompted the decision to have the employees trained on customer service.

3 0
3 years ago
Read 2 more answers
Other questions:
  • A manager wants to set up an area that is not on the LAN but not quite on the Internet. This area will house servers that will s
    5·1 answer
  • Insurance can help you:
    12·1 answer
  • Need help with just #8
    12·1 answer
  • In the single-site processing, single-site data (SPSD) scenario, all processing must be done on the end user's side of the syste
    10·2 answers
  • What important practice can help prevent hardware trouble?
    6·1 answer
  • Which type of microscope can only be used to view non-living specimens?
    10·2 answers
  • Apple's macOS and Microsoft Windows are examples of ________ software. utility application communication operating system
    13·1 answer
  • you are working on creating a business document with two other co-workers. Based on just information, which of the following pre
    14·1 answer
  • What is data intergrity​
    13·1 answer
  • The objective fuction of linear progrmming should be
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!