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
  • PrintPrint
Share this Page URL
Help

Chapter 8. More on Classes > Using Classes

8.6. Using Classes

I've touched on most of the basic aspects of defining a native C++ class, so maybe we should look at how a class might be used to solve a problem. I'll need to keep the problem simple to keep this book down to a reasonable number of pages, so we'll consider problems in which we can use an extended version of the CBox class.

8.6.1. The Idea of a Class Interface

The implementation of an extended CBox class should incorporate the notion of a class interface. We are going to provide a tool kit for anyone wanting to work with CBox objects so we need to assemble a set of functions that represents the interface to the world of boxes. Because the interface represents the only way to deal with CBox objects, it needs to be defined to cover adequately the likely things one would want to do with a CBox object, and be implemented, as far as possible, in a manner that protects against misuse or accidental errors.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint