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
Most keyboards today are in a
BlackZzzverrR [31]
Qwerty format I think.
6 0
3 years ago
1.What is a keyboard layout.
irina [24]

Answer:A keyboard layout is any specific physical, visual or functional arrangement of the keys, legends, or key-meaning associations  of a computer keyboard, mobile phone, or other computer-controlled typographic keyboard.

An output device is any peripheral that receives data from a computer, usually for display, projection

A printer is an output device that prints paper documents. This includes text documents, images, or a combination of both

Laser Printers and LED printers

Explanation:

8 0
3 years ago
Cloud suites are stored on your hard drive and are available anywhere you can access the Internet
puteri [66]
Is that a question or an answer... im confused?!?!

5 0
3 years ago
A flower is an example of _______________? (Select the best answer.)
Zigmanuir [339]

Answer:

flora

Explanation:

Flora is plant life; fauna refers to animals. Fauna derives from the name of a Roman goddess, but the handiest way to remember the difference between flora and fauna is that flora sounds like flowers, which are part of the plant world; fauna, however, sounds like "fawn," and fawns are part of the animal kingdom.

7 0
3 years ago
Read 2 more answers
The alumni development office at your university uses specialized software that can be accessed from two different servers. The
Agata [3.3K]

Answer:

Round-Robin DNS

Explanation:

According to my experience in Information Technology and Networking it can be said that based on the information provided the best solution would be to set up a Round-Robin DNS. This term refers to a technique used to balance the load on a server, where a client request is sent to each server one at a time, and then the system repeats the process from the top of the request list. This prevents the server from being drowned in a sea of simultaneous requests.

If you have any more questions feel free to ask away at Brainly.

6 0
3 years ago
Other questions:
  • A machine is classified as a compound machine if it?
    8·2 answers
  • Forms are used to a provide a more user-friendly way to work with data in tables
    14·1 answer
  • What is the term for the conversion of a bitmap image to a vector image?
    8·1 answer
  • Consider the following statements: #include #include class Temporary { private: string description; double first; double second;
    9·1 answer
  • Which statement about images is correct? A) A virtual image cannot be formed on a screen. B) A virtual image cannot be viewed by
    12·1 answer
  • Urgent ..algorithm and flowchart to check weather a number is odd or even ???​
    8·2 answers
  • Write an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If th
    5·1 answer
  • Two technicians are discussing a parasitic load test. Technician A says that the parasitic load is measured with an ammeter Tech
    13·1 answer
  • Write a program, called compute_stats.c, which opens a data file, called numbers.txt, which contains of a list of positive integ
    10·1 answer
  • Do anyone know how to code like I need someone do a code for me?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!