Chapter 3

Planning and Building Objects

IN THIS CHAPTER

check Recognizing objects so that you can create classes

check Encapsulating classes into self-contained capsules

check Building hierarchies of classes through inheritance

Step outside for a moment and look down. What is the thing you are standing on? (Hint: It’s giant, it’s made of rock and sand and stone and molten lava, and it’s covered with oceans and land.) The answer? A thing! (Even a planet is a thing.) Now go back inside. What’s the thing that you opened — the thing with a doorknob? It’s a thing, too! It’s a slightly different kind of thing, but a thing nevertheless. What are you standing in inside? Okay, you get the idea. Everything you can imagine is a thing — or, to use another term, an object.

Over the years, researchers in the world of computer programming have figured out that one of the better ways to program computers is to divide whatever it is you’re trying to model into a bunch of objects. These objects have methods (capabilities) and properties (characteristics). (Eventually they have relationships, but that comes later.)

In this chapter, you see how to make use of objects to create a software application. In the process, ...

Get C++ All-in-One For Dummies, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.