C++ Knowledge Base

Version 1.5,

Purpose:

This page provides links to the most important parts of the C++ Programming Lanaguage and the design strategies used to build C++ programs and systems.

Starting with Basic Syntax and Semantics, we step through increasingly sophisticated materials including techniques used for design. When you have mastered these, you have all the tools you need to start professional work.

References, Tutorials, and Texts
References, tutorial links, and texts we use in CSE687 - Object Oriented Design.
cppreference.com
This is an excellent reference for the syntax and semantics of the C++ Programming Language. Also includes code snippets for most items.
cplusplus.com, cprogramming.com, tutorialspoint.com, learncpp.com, wustl.edu
Basic tutorials on the C++ Programming Language syntax and elementary semantics.
The C++ Programming Lanaguage (CPPPL) , Fourth Edition, Bjarne Stroustrup
The C++ Standard Library, Nicolai Josuttis
These are the texts used in CSE687 - Object Oriented Design.
C++ Primer, Lippman et. al.
This text is a good tutorial, but not as complete as The C++ Programming Language.
Visual Studio
Visual Studio is an Integrated Development Environment (IDE) for developing code in several languages. This section provides links to download and view documentation.
Download Visual Studio 2017 - Community Edition
The Community Edition is free for academic use and has virtually all the features of Visual Studio Pro.
Visual Studio videos, Walk-Thru documentation
These videos and walk through documentation from Microsoft should get you up to speed quickly.
Basic Syntax and Semantics
This section describes the elementary parts of the C++ Programming Language.
C++ Survival Guide, doc
Summarizes pointers, references, classes, strings, streams, and vectors.
C versus C++
C++ uses a core of the C Language. This page describes what C++ adds to C.
C++ Models, ppt
Illustrates models for Building C++ programs, a program's computational environment, and a model for program memory.
Classes
Here we discuss the anatomy of a C++ class, template classes, and the relationships between classes.
Anatomy of a C++ class
Demonstrates declarations and implementations of various member functions of a typical class.
Template Classes
Illustrates the syntax for defining parameterized classes using templates.
ClassRelationships, Class Relationships Diagram, Object Relationships Diagram
There are four relationships between classes: inheritance, composition, aggregation, and using. All the major OO languages, C++, Java, and C#, enable these relationships. The rules are somewhat different for the managed languages.
Abstract Data Types
ADTs are classes with instances that support copying, assignment, and storing in arrays, e.g., they behave like the built-in primitive types.
Str - custom string class, pptx
Demonstrates declarations, definitions, and invocations for each of the member functions in an ADT - a string class. This is a teaching tool; you should prefer the std::string class for your own programs.
Str class code
Code for everything discussed in the Str presentation.
C++ operators, pptx
Many of the C++ operators can be overloaded in your classes and as global functions. This presentation shows how to do that and why you might want to.
Compound Objects
Compound objects are instances of a class that inherits from, composes, and/or aggregates instances of other classes.
Compound Class and Object Relationships
Illustrates the structure of a Compound Object example - both class structure and layout of instances in memory.
Compound Objects
Explains, with descriptions and code, how compound objects work, focusing on the construction and destruction of instances. Pay particular attention to the constructor initialization sequences.
Compound Object Example code
Code for everything discussed in the previous page link.
Inheritance and Polymorphism
Public inheritance is a specialization relationship. A derived class "is-a" specialized version of its base. Inheritance is especially important for developing programs that support substitution. This affords great flexibility in a program that uses inheritance. To support a changed program mission, we simply substitute a part that carries out the required mission functionality, without causing any breakage to the rest of the system.
ClassRelationships
There are four relationships between classes: inheritance, composition, aggregation, and using. All the major OO languages, C++, Java, and C#, enable these relationships. The rules are somewhat different for the managed languages.
Inheritance Example
Provides a simple example of inheritance and shows how substitutability is achieved.
OO Design
Explains how the four class relationships are used to structure Object Oriented Designs.
Design
Design is the process of deciding:
  • what classes and global functions are needed for your program's activities.
  • how to allocate those parts to packages1.
  • what data has to flow between packages and what must be stored for later use.
  • how to access one part from another2.
Software Design
Discusses the issues you need to consider when creating designs in any modern language.
OO Design
Explains how the four class relationships are used to structure Object Oriented Designs.
Design Principles
Statements for a number of design principles. If you understand them, and apply them sensibly, that's very likely to result in a good design. They don't insure a great design. For that, you need inspiration, experience, and a dose of luck.
Prime Directives
Some simple maxims that help to keep your development life sane.
Software Structure
Software structure is often driven by the main activities in a system. This page discusses several different structures, driven by different application needs.
To keep improving, it helps to have a healthy sense of dissatisfaction with your code. When you've finished a project you might ask: does the code need to be this big, complex, and hard to navigate? How could I improve the design? Why didn't my testing find more of the latent errors? How did respected designers A, B, or C handle these problems?

  1. In C++, a package consists of two files, a header and an implementation file. Each has prologue comments and the implementation file has an embedded construction test. Here's an example.
  2. Access is automatic if the caller composes or agregates the callee. Other cases get more complex.
C++ Conferences
Questions with Answers

CST strip