This preview shows page 1. Sign up to view the full content.
Unformatted text preview: at
set the time
print the time
increment the time by a second
compare two times for equality
determine if one time comes before another
W e are not saying how these requirements are to
be implemented – the user doesn't need to know.
That's an abstract data type.
Applied Programming Applied Programming Here is a suitable declaration.
void Write() const;
bool Equals(const TimeType&) const;
bool IsBefore(const TimeType&) const;
int hours, minutes, seconds;
} Let's look in some detail. Applied Programming The functions Set(), Increment() and
Set() Increment() and
Write() don't have an argument indicating what
we are setting, incrementing or writing.
How does the program know what data to
Because the name of the identifier precedes the
function when it is used.
function Let's create an instance of a TimeType.
This creates space for the data component of the
class – currently (and...
View Full Document
- Spring '14