CO311: class miltime

This sequence of examples shows the development of a really useful set of member functions with a class meant to manage military time.

Example Number miltime.h miltime.cpp timetest.cpp Goal
0     Beginning case with data-only object and unmanaged manipulation
1     Streamlining with class-specific functions (but not yet members)
2     Additional functions to manipulate the class, but without “binding” the data members
3 Protecting the data members and manipulating them with “binding” member functions.
4 Enhancing the constructor to take initialization values
5 Adding two objects together: making it really work with “bound data” functions.

 

Example Number miltime.h miltime.cpp timetest.cpp Goal
6 Introducing user-defined operators: operator+
7 Introducing friend keyword: creating an object-specific stream output function using operator<<
8 Streamlining with this
  clocktime.h clocktime.cpp    
9 switching between 24 and 12 hour times (“clock” time) with a static data member
10 Storing all the data in one private member (instead of three)