Adts the assignment operator is coming this is called

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: s look at operators in general. Many of C++'s built-in operators are polymorphic. They designate the same general operation on They different types. different See how simple this is. That's why it isn't needed for this class. We can re-use almost all the built-iin operators for n our own ADTs. ADTs The assignment operator is coming. This is called operator overloading. This operator Applied Programming Consider the public function Equals() for Consider Equals() for our class TimeType. TimeType Recall that time1.Equals(time2) iis true iif time1 and time2 are equal. s true f time1 and time2 Wouldn't this be more natural? Applied Programming A warning The concept of operator overloading is like The opening Pandora's Box. opening There's no going back. Provide one operator and users will assume Provide they're all available. they're time1 == time2 Well, we can provide this. Applied Programming So consider this step carefully. Applied Programming W hen a binary operator, say • (representing one When (representing of the b...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online