Unlock access to all the studying documents.
View Full Document
Copyright Cengage Learning. Powered by Cognero.
1. In C++, >> is used as a stream extraction operator and as a right shift operator.
2. Operator functions typically return void.
3. Operators can be overloaded either for objects of the user-defined types, or for a combination of objects of the user-
defined type and objects of the built-in type.
4. In C++, operator is a reserved word.
Copyright Cengage Learning. Powered by Cognero.
20. The general syntax to overload the stream extraction operator >> for a class is ____.
istream& operator>>(istream&, className&);
const istream& operator>>(istream&, className&);
friend operator>>(istream&, className&);
friend istream& operator>>(istream&, className&);
21. The return type of the function to overload the operator >> must be a reference to a(n) ____ object.
22. Which of the following is a built-in operation on classes?
23. The general syntax for the function prototype to overload the assignment operator = for a class is ____.
friend className& operator=(const className&);
className& operator=(className&);
string className& operator=(className&);
const className& operator=(const className&);
Copyright Cengage Learning. Powered by Cognero.
Type operator[](int index);
Type& operator[](int index);
31. Which of the following is the syntax to declare the operator function operator[] as a member function of a class
for constant arrays?
const Type& []operator(int index) const;
const Type& operator[](int index) const;
const Type& operator[](int index);
const Type [](int index) const;
32. Using a class template, you can write a single code segment for a set of related ____.
33. Class templates are called ____ types.
Copyright Cengage Learning. Powered by Cognero.
37. Any function that overloads an operator is called a(n) ____________________ function.
38. The operators that cannot be overloaded are ., .*, ::, ?:, and ____________________.
39. The only built-in operations on classes are assignment (=) and ____________________.
40. The ____________________ operator causes a member-wise copy of the member variables of the class.
41. A(n) ____________________ constructor converts its argument to an object of the constructor’s class.