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; ...
Get Absolute Beginner's Guide to Programming, Third 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.