This preview shows page 1. Sign up to view the full content.
Unformatted text preview: nics of this.
Applied Programming Applied Programming The first argument of each function is a reference
to the instance.
void Write() const;
void Write(const TimeType&);
with all the protection usually afforded. Such functions which only look at the private data
of a class are called
observer or accessor functions
(Those that change the contents are called
But what if we want to access the private data of
another instance, for example, to compare their
We pass it as an argument as in
bool Equals(const TimeType&) const; Applied Programming What happened to the private nature of the data?
W e are looking at it from another instance of the
bool Equals(const TimeType&) const; gets one instance via the name before the
function and the other via the argument.
Applied Programming W e've now got an interface for the class, stored in
TimeType.h. Let's now loo...
View Full Document
- Spring '14