O'Reilly logo

Absolute Beginner's Guide to Programming, Second Edition by Greg Perry

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

Introducing Objects

You've already seen examples of objects. All data values are potential objects in the C++ language. Variables are objects. Although objects can get much more complex than simple variables, a variable is a valid object. In addition, you've now been introduced to the objects cin and cout. Although cin and cout are predefined language objects and are not like many other objects in programs, they do work in the same way that all other objects work. You'll learn about this in the rest of this chapter.

An object is like a package that exists inside a C++ program. All objects have behaviors and properties. Consider the following object definition:

int intObj = 17;   // Defines an integer object

The integer variable intObj has properties; ...

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