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

1. When an operator is overloaded as a member of a class, the first parameter listed in parentheses, is the calling object.
2. If a unary operator is overloaded as a stand-alone function, the argument may be any type.
3. Overloading an operator cannot change the precedence of that operator with respect to other operators.
4. If I need to build an object for return from a function, I can construct that function directly in the return statement.


1. False
This is backwards. The calling object is the first argument.
2. False
All overloaded operator functions must have at least one class type argument or be a member of a class. In the case of a unary operator, if it is overloaded as a member, there is no argument, there the class type calling object is the argument. If overloaded as a friend, there is one argument.
3. True
4. True
Given class A, which has a two int constructor, A(int, int). If I have a function, that needs to build a return object, it can be done by creating an anonymous A object directly in the return statement.
```
A func( int arg)
{
return A(arg, 2*arg);
}
```

Computer Science & Information Technology

You might also like to view...

A site that enables you to share video, image, and music files with others is called a(n) ________ site

Fill in the blank(s) with correct word

Computer Science & Information Technology

A page printer will not start the printing process until the entire page is received

Indicate whether the statement is true or false

Computer Science & Information Technology

Precise control for moving selected objects on a form is accomplished by using the ____________________ keys on the keyboard.

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

Computer Science & Information Technology

Productivity applications include all of the following EXCEPT _____ software.

A. antivirus B. spreadsheet C. word processing D. database

Computer Science & Information Technology