Miscellaneous Items

Chapter 17 - Classes in C++

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

Chapter 17: Classes in C++
Overview
A primitive C++ class can be created by using the struct keyword, as you learned in the previous chapter. You also learned how to create several elementary C++ classes by using the class keyword. Both types of examples illustrated the simple fact that classes can contain member data and member functions (methods) that act on that data. In this chapter, you will learn more details about C++ classes—nesting of classes and structures, the use of constructors and destructors, overloading member functions, friend functions, operator overloading, derived classes, virtual functions, and other miscellaneous topics. These class structures create objects that form the foundation of object-oriented programs.
The programming flexibility offered to the C++ programmer is, to a large degree, a result of the various data types discussed in earlier chapters. The C++ class gives you another advantage: the benefits of a structure along with the ability to limit access to specific data to functions that are also members of the class. As a result, classes are one of the greatest contributions made by C++ to programming. The added features of the class over earlier structures include the ability to initialize and protect sensitive functions and data.
Consider, for example, the increase in programming power you have gained with each new data type. Vectors or one-dimensional arrays allow a group of like data types to be held together. Next, structures allow related items of different data types to be combined in a group. Finally, the C++ class concept takes you one step further with abstract data types. A class allows you to implement a member data type and associate member functions with the data. Using classes gives you the storage concept associated with a structure along with the member functions to operate on the member variables.

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net