Code Containers

Table of contents:

One aspect of C++ that makes it very powerful is its ability to package code in several different ways.

Table 7.1 defines some terms that are used to describe containers of code. The table is arranged (approximately) in order of increasing granularity from top to bottom.

Table 7.1. Reusable Components


Visible attributes



class Classname { body } ;

A collection of functions and data members, and descriptions of its lifecycle management (constructors and destructors)


namespace name { body } ;

A collection of declarations and definitions, of classes, functions and static members, perhaps spanning multiple files

header file


Class definitions, template definitions, function declarations (with default argument definitions), inline definitions, static object declarations

source code module


Function definitions, static object definitions

compiled "object" module

.o or .obj

Each .cpp module is compiled into a binary module as an intermediate step in building a library or executable.


.lib or .la (+ .so or .dll if dynamic)

An indexed collection of object files linked together. No main() function must exist in any code module in a library.

devel package

lib + header files

A library along with accompanying header files


.exe on windows, no particular extension on *nix

A collection of object files, linked with libraries, to form an application. Contains exactly one function definition called main().

Reusing Other Libraries

Part I: Introduction to C++ and Qt 4

C++ Introduction


Introduction to Qt



Inheritance and Polymorphism

Part II: Higher-Level Programming


Introduction to Design Patterns


Generics and Containers

Qt GUI Widgets


Validation and Regular Expressions

Parsing XML

Meta Objects, Properties, and Reflective Programming

More Design Patterns

Models and Views

Qt SQL Classes

Part III: C++ Language Reference

Types and Expressions

Scope and Storage Class

Statements and Control Structures

Memory Access

Chapter Summary

Inheritance in Detail

Miscellaneous Topics

Part IV: Programming Assignments

MP3 Jukebox Assignments

Part V: Appendices

MP3 Jukebox Assignments


MP3 Jukebox Assignments

An Introduction to Design Patterns in C++ with Qt 4
An Introduction to Design Patterns in C++ with Qt 4
ISBN: 0131879057
EAN: 2147483647
Year: 2004
Pages: 268 © 2008-2020.
If you may any questions please contact us: