O'Reilly logo

An Introduction to Design Patterns in C++ with Qt 4 by Paul Ezust, Alan Ezust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Classes

This chapter provides an introduction to classes and objects, and how member functions operate on objects. UML is introduced. static and const members are explained. Constructors, destructors, copy operations, and friends are discussed.

2.1

Structs

48

2.2

Class Definitions

49

2.3

Member Access Specifiers

51

2.4

Encapsulation

54

2.5

Introduction to UML

54

2.6

Friends of a Class

55

2.7

Constructors

56

2.8

Subobjects

58

2.9

Destructors

60

2.10

The Keyword static

61

2.11

Copy Constructors and Assignment Operators

64

2.12

Conversions

67

2.13

const Member Functions

68

Structs

In the C language, there is the struct keyword, for defining a structured chunk of memory.

Example 2.1. src/structdemo/demostruct.h

[ . . . . ] struct Fraction { int numer, denom; string description; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required