O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

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

4.1. What Is Encapsulation?

Object-oriented languages like C++ enable you to create your own data types. This is important for several reasons.

  • New data types make programs easier to visualize and implement from designs.

  • User-defined data types are reusable.

  • You may modify and enhance new data types as programs evolve and specifications change.

  • New data types let you create objects with simple declarations.

An object is an instantiation of a data type. Here are some examples.

Window w;                      // Window object 
Database ood;                  // Database object
Device d;                      // Device object

Once we create new data types and instantiate objects, what can programs do with them? New data types come with a set of legal operations, or methods. Programs manipulate objects through ...

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