CS 492 Chapter 1 Answers To Odd Questions
Chapter 14 Operator Overloading
1. The function is just like a regular function except that the function must be named with word operator followed by the actual operator. For example, see the following function header
bool operator are no Rational object.
17. No, because the function does not need to access the private members in Rational.
18.
operator int()
19.
You can convert a primitive type value to an object by defining a constructor with the primitive type as the sole parameter.
20.
No. It may cause ambiguity compile error because the compiler cannot decide which function to use. For example, for a Rational object r, r + 4 would cause an ambiguity error.
21.
If an operator can be overloaded as a non-member function, define it as a non-member function to enable implicit type conversions.
22.
No
23.
const cannot be used with non-member functions.
24.
The error: cannot convert an int to a Rational.
25.
No. A static function cannot be defined as a const function. Only the instance member function can be defined as a const function.
26.
You need to overload the = operator to perform a customized copy operation for an object.
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- answers to homework questions free
- genesis chapter 1 questions and answers
- snappy answers to stupid questions pdf
- psychology chapter 1 questions and answers
- mad s snappy answers to stupid questions book
- answers to tax questions free
- chapter 1 intro to psychology quizlet
- chapter 1 introduction to life span
- answers to chapter 7 contemporary econo
- answers to bible questions online
- answers to interview questions pdf
- answers to the exerpt in chapter 2