Main Page

Previous Page
Next Page

[Page 74]

Chapter 3. Introduction to Classes and Objects

You will see something new. Two things. And I call them Thing One and Thing Two.

Dr. Theodor Seuss Geisel

Nothing can have value without being an object of utility.

Karl Marx

Your public servants serve you right.

Adlai E. Stevenson

Knowing how to answer one who speaks, To reply to one who sends a message.



In this chapter you will learn:

  • What classes, objects, member functions and data members are.

  • How to define a class and use it to create an object.

  • How to define member functions in a class to implement the class's behaviors.

  • How to declare data members in a class to implement the class's attributes.

  • How to call a member function of an object to make that member function perform its task.

  • The differences between data members of a class and local variables of a function.

  • How to use a constructor to ensure that an object's data is initialized when the object is created.

  • How to engineer a class to separate its interface from its implementation and encourage reuse.

[Page 75]


3.1 Introduction

3.2 Classes, Objects, Member Functions and Data Members

3.3 Overview of the Chapter Examples

3.4 Defining a Class with a Member Function

3.5 Defining a Member Function with a Parameter

3.6 Data Members, set Functions and get Functions

3.7 Initializing Objects with Constructors

3.8 Placing a Class in a Separate File for Reusability

3.9 Separating Interface from Implementation

3.10 Validating Data with set Functions

3.11 (Optional) Software Engineering Case Study: Identifying the Classes in the ATM Requirements Document

3.12 Wrap-Up



Self-Review Exercises

Answers to Self-Review Exercises


Previous Page
Next Page