More C++
Tim Love
January 20, 2000
Abstract:
This document aims to provide people who have done an introductory C++ course the skills required to write bigger programs. Online versions are at
http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/doc/doc.html
(HTML);
http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/doc/doc.pdf
(PDF); and
http://www-h.eng.cam.ac.uk/help/documentation/docsource/index.html
(LaTeX).
Contents
Introduction
Review
Keywords
Built-in Types and Enumerations
Operators
Selection
if
switch
Loops
while, do
for
Aggregation
arrays
structures and classes
Pointers
Functions
Declarations
Memory Allocation
Scope and Namespaces
Exercises
Object-orientated programming
Classes
Derived classes
Friend classes and functions
Class member privacy
Static members
Const members
Static Const members
Overriding behaviour
Exercises
Templates
The Standard Library
Iterators
Strings
Iterators
Size
Routines
vector
Queues
list
map
bitset
valarray
Algorithms
Set algorithms
Using member functions
Predicates
Creating predicates
Adapters
Exercises
Dodgems: A longer exercise
Arithmetic Routines
Geometric Routines
Graphics Routines
Decision Routine
Creating the Dodgem class
Putting it all together
Exceptions
More on Classes
Virtual members
Abstract Classes
Redefining operators
A class definition example
assignment operator
this
copy constructor
Redefining [ ]
Redefining ()
Redefining
->
Exercises
Input/Output
Simple I/O
Formatting
Stream Iterators
Output of User-Defined types
Input of User-Defined types
String streams
Casts
Limits
Performance
Debugging
Common Difficulties and Mistakes
Program Development
Style
Makefiles
Specialist Areas
Maths
Hardware Interfacing: bit operations and explicit addresses
Using routines from other languages
C
Fortran
The CUED Teaching System setup
A case history:
linkscan
Classes
Code Organisation
Testing
Comparison of the C and C++ versions
C habits to give up
Things you probably don't need to know yet
virtual inheritance
typeid
Pointers to Members
virtual destructors
Auto pointers
operator functions
union
Making New Containers
Non-type template parameters
Initialising from tables
Glossary
References
Dodgem solution
dodgem.cc
dodgemgraphics.cc
Tim Love
2000-01-20