Lecture overview -- Keyboard shortcut: 'u'  Previous page: Design and Programming -- Keyboard shortcut: 'p'  Next page: Quotes -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 6 - Page 3 : 4
Notes about C++
Design Using C++
Kind of Classes

Chapter 25 of The C++ Programming Language

  • Concrete types

    • Resembles built-in types

    • Do not take part in a class hierarchy

    • Provides run-time and space efficiency that makes them comparable to 'hand crafted' code

    • Similarities between concrete types are expoited by use of templates

    • Hide as much of the implementation as feasible without hurting performance

      • Use of inline functions helps a lot

    • Instances do not need allocation on the free store

  • Abstract types

    • Represents a single interface to a set of different implementations

    • Do not normally have constructors

    • Makes use of virtual functions, and virtual destructors as well

    • Instances (of subclasses) must be accessed via pointers or references

  • Node classes

    • Part of a class hierarchy

    • Relies on services from base classes

    • Adds new functions to the interfaces

    • Programming by difference/extension

    • Direct instances can exists - the class has one or more constructors

  • Action classes

    • An alternative to functions

    • An action can easily encapsulate 'its own data'

    • An instance of an action class is not 'fired' in the same way as a function is called

      • Can be seen as a delay

  • Interface classes

    • Adjust the interface of a class - similar to the Adapter design pattern

    • Handles name clashes when merging class hierarchies - multiple inheritance

    • Use of forwarding functions

      • For instance by redirecting a call to a virtual function

      • See pattern page 779

    • Wrappers for range check - page 781

  • Handle classes

    • A class small enough to allow value semantics - static allocation in a local variable

    • Encapsulates a pointer to the data representation proper

    • Example: The string class

Some observations from this chapter is similar to material normally covered by design pattern literature