Binding Together Data and Operations

Structures also support the concept of binding by combining data fields. They allow you to combine different components into a composite data object. These composite objects can be manipulated as a whole, for example, sent as a parameter to a function, or they can provide access to their components individually.

A structure definition, however, models only a set of data but not their behavior. The server programmer provides the tools to manipulate the data, that is, a set of access functions to access and manipulate data on behalf of client functions. In "functional" or "procedural" programming, data and algorithms are syntactically separated. They are related together only in the mind of the programmer, ...

Get Core C++ A Software Engineering Approach 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.