Computer Science 1037A/B Lecture Notes - Lecture 29: Memory Management, Operand, Reverse Polish Notation

28 views3 pages

Document Summary

Operators such as = , +, and others can be redefined for use with objects of a class. The name of the function for the overloaded operator is operator followed by the operator symbol operator+ is the overloaded + operator operator= is the overloaded = operator. Operators can be overloaded as: instance member functions friend functions. The overloaded operator must have the same number of parameters as the standard version operator= must have two parameters, since the standard = operator takes two parameters. A binary operator that is overloaded as an instance member needs only one parameter, which represents the operand on the right. The left operand of the overloaded binary operator is the calling object. The implicit left parameter is accessed through the this pointer. Operator can be invoked as a member function. It can also be invoked in the more conventional manner.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents