Balance Example
This program illustrates splitting declarations from definitions,
especially for classes and named constants.
- dollar.h
- Note the use of extern const to
declare CENTS_PER_DOLLAR. It has just one definition in dollar.cpp
but the declaration allows it to be used in any file that includes dollar.h.
- dollar.cpp
- balance.cpp
To build, download makefile and type
make
It will also build in the old-fashioned way
g++ -std=c++11
but the nice thing about the makefile is that if you edit one of the sources
the minimum number of files are recompiled.
Other Sample Programs