Answer the following statements true (T) or false (F)

1. When overloading an operator, you can change the behavior of the operator, making + do things that feel like multiplication, but this is unwise.
2. When overloading an operator, you can create a new operator different from the more usual operators.
3. When overloading an operator, you cannot change the number of arguments an operator takes.
4. Overloaded operator <<, when used as an output, returns an ostream& to allow chains of output statements, and similarly the overloaded operator >> returns an istream&


1. True
This unwise mischief is one of the pitfalls of operator overloading.
2. False
You are restricted to the operators provided. (C++ is large enough now, doing this would make it much too large.)
3. True
The compiler recognizes the operators and expects them have the usual of arguments.
4. True
We do this so that our overloaded operator << mimics the behavior of the overloaded operator << for primitive types. Uniformity of behavior of user and built-in types is a goal of C++ design.

Computer Science & Information Technology

You might also like to view...

How is the data input size determined for a logarithmic O(log n) algorithm?

a. By using the inverse of the logarithm function b. By using the logarithm function c. By using a polynomial function d. By multiplying the time and input data size

Computer Science & Information Technology

?Whenever there is a computer security incident, it is not recommended that the organization reveal all they know in public forums.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

If you have not selected a 3D object on the _______________, the 3D panel displays tools to create one.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Android Studio’s app templates have been updated to use the library, enabling the new apps you create to run on almost all Android devices, including ones with older Android versions.

a. Compatibility b. AppCompat c. SupportLibrary d. None of the above.

Computer Science & Information Technology