subject

We saw that it's common for an overloaded assignment operator in a class X to be declared with the return type X&. However, this turns out not be to an absolute requirement in C++; a program can compile with the return type being something different. Suppose that you wrote a class X with each of the following assignment operators declared. For each of them, briefly explain why making the specified design choice, rather than the usual one, would be problematic.
1. void operator=(const X& x)
2. X operator=(const X& x)
Answer these separately; in each case, only one of the assignment operators is declared, never both of them. Note that it wouldn't be an honest attempt to answer this question to say something like "Because C++ programmers usually declare an assignment operator as X& operator=(const X& x) instead." This question isn't asking what the usual design choices are; this question is about why.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Which is the highest level of the hierarchy of needs model? a. humanity b. intrapersonal c. team d. interpersonal
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
question
Computers and Technology, 23.06.2019 10:00
Install and use wireshark program ( send back screen shots and other vital information) case project 3-2: decode a tcp segment in a wireshark capture in this chapter, you walked through tcp segment to interpret the data included in its header. in this project, you use wireshark to capture your own http messafes, examine the tcp headers, and practice interpreting the data you'll find there. 1. open wireshark and snap the window to one side of your screen. open a browser and snap that window to the other side of your screen so you can see both windows.
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
You know the right answer?
We saw that it's common for an overloaded assignment operator in a class X to be declared with the r...
Questions
Questions on the website: 13722363