Chapter 1. Planning and Building Objects
In This Chapter
Recognizing objects so you can create classes
Encapsulating classes into self-contained capsules
Building hierarchies of classes through inheritance
Discovering classes
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.) And 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. And what are you inside? Okay, you get the idea. Everything you can imagine is a thing. Or, to use another term, an object. Remember that word: object.
Over the years, researchers in the world of computer programming (now, doesn't that sound like an exciting job?) have figured out that the best way to program computers is to divide whatever it is you're trying to model into a bunch of objects. These objects have capabilities and characteristics. (Eventually they have relationships, but that comes later.)
In this chapter, we show you how to make use of objects to create a software application. In the process, you get to twist some of the nuts and bolts of C++ that relate to objects and get tips on how to get the most out of them.
Recognizing Objects
Let's get to the meat of it: Think of an object as any thing that a computer can describe. (Object = thing. How's ...
Get C++ All-In-One For Dummies®, 2nd 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.