Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9. C++ Class as a Unit of Modula... > Binding Together Data and Operations

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, not in code. In the examples that I discussed in Chapter08, "Object-Oriented Programming with Functions," I used object diagrams to indicate that functions and data logically belong together.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial