Exam 8: Operator Overloading,friends,and References

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

An operator overloading is essentially a function that uses a different syntax for invocation.

(True/False)
4.7/5
(33)

Overloading an operator cannot change the precedence of that operator with respect to other operators.

(True/False)
4.9/5
(39)

A class can have friends that are functions as well as friend classes.

(True/False)
4.8/5
(35)

When an operator is overloaded as a member of a class,the first parameter listed in parentheses,is the calling object.

(True/False)
4.9/5
(38)

An overloaded operator[] must be a non-static class member.

(True/False)
4.8/5
(42)

Why have we not needed to overload the assignment operator so far?

(Essay)
5.0/5
(34)

You can change the behavior of + for the int type using operator overloading.

(True/False)
4.8/5
(35)

Overloaded operator <<,when used as an output,returns an ostream& to allow chains of output statements,and similarly the overloaded operator >> returns an istream&

(True/False)
4.8/5
(36)

Overloading a binary operator as a member requires two arguments.

(True/False)
4.8/5
(33)

What objections to the use of friend functions and classes do some experts give?

(Essay)
4.9/5
(30)

Show how to overload the operators << and >> to create stream output for this class. Make these functions friends of the class Pair.The expected form of a pair is (2,3)for both input and output.To make this problem manageable,you should only provide to accept and discard the parentheses and comma,but you should not check that these particular characters were typed.Output should be the expected form. class IntPair { \quad int first; \quad int second; \quad public: \quad\quad IntPair(int firstValue,int secondValue); \quad\quad int getFirst( )const; \quad\quad int getSecond( )const; };

(Essay)
4.9/5
(35)
Showing 21 - 31 of 31
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)