Binary Operators - Assignment


The binary arithmetic assignment operators: +=, -=, /=, *= and %= are extendible as well. While some of these operators would not be meaningful on the Date class, at least the first four would each be meaningful on the Complex class.

Defining these operators on the Complex class will permit the following:

image from book

 aComplex += bComplex; aComplex -= bComplex; aComplex /= bComplex; aComplex *= bComplex; 

image from book

When appropriate, these binary assignment operators could be defined on any class. For example: cmlxasgn.cpp.




Intermediate Business Programming with C++
Intermediate Business Programming with C++
ISBN: 738453099
EAN: N/A
Year: 2007
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net