Вы находитесь на странице: 1из 2

ProgrammingwithAnsiC++:AStepbyStepApproachBhushanTrivedi

OxfordUniversityPress2010.Allrightsreserved.

SolutionsManualforANSIC++:AStepbyStepApproach

Chapter6:OPERATOROVERLOADINGandUSERDEFINEDCONVERSIONS

1.Whatisthesignificanceofoperatoroverloading?WhyitisprovidedbyC++?
The6.1providestheanswer.

2.Whataretherestrictionsonoperatoroverloading?
TheAnswerisprovidedby6.2

3.Listoperatorswhichcannotbeoverloaded
Listofsuchoperatorsisprovidedin6.2.1

4.Listoperatorswhichcannotbeoverloadedasfriend.
6.2.2containssuchlist.

5.Listthedifferencebetweenoperatoroverloadedasmemberandoperatoroverloadedasfriend
Thedifferencesimilartoadifferencewehaveseenformembersandnonmembers.Additionallythe
6.7 and 6.8 section shows the cases where operator overloaded as friend is better or only viable
option.

6.Differentiatebetweenoverloadingofunaryoperatorsandoverloadingofbinaryoperators

a. Overloading unary operator require no argument when overloaded as member but require one
argumentwhenoverloadedasfriend
b. Overloading binary operator require one argument when overloaded as member and two
argumentwhenasafriend

7.Differentiatebetweenoverloadingpostfixoperatorandprefixoperator.
Thepostfixoperatoroverloadingrequiresadummyintegerargument.

8.Whyshorthandoperatorsareusefulwhenbasicoperatorsarealreadyoverloaded?
Thisisexplainedin6.6.1

9. Why we need to pass and return a reference of the stream object when we overload << and >>
operators?
Thisisexplainedattheendofsection6.8

10.Whatarefunctionobjects?Whytheyareuseful?
Theanswerisprovidedin6.10

11.Overloadingnewanddeletemayhelpusinmanagingmemoryourselves.Explainthissentence.
Theexamplein6.11.1.2explainssuchcase

ProgrammingwithAnsiC++:AStepbyStepApproachBhushanTrivedi
OxfordUniversityPress2010.Allrightsreserved.

12.Whatarethetypesofconversion?Compareeachtypeofconversion
Wehavefourdifferenttypesofconversion,theyareexplainedin6.14

Вам также может понравиться