Storage Classes

Chapter 16 - Object-oriented Programming Foundations

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

Object-oriented Programming
Object-oriented programs (OOPs) function differently from the traditional procedural approach. They require a new programming strategy that is often difficult for traditional procedure-oriented programmers to grasp. In the next four chapters you will be introduced to the concepts that make up object-oriented programming in C++. If you have already written or examined program code for Windows 95, 98, or NT, you have had a taste of one of the concepts used in object-oriented programming—that a program consists of a group of objects that are often related. With C++, objects are formed by using the new class data type. A class provides a set of values (data) and the operations (methods or member functions) that act on those values. The resulting objects can be manipulated by using messages.
It is the message component of object-oriented languages that is also common to Windows and Presentation Manager programs. In object-oriented programming, objects hold not only the data (member data), but the methods (member functions) for working on that data. The two items have been combined into one working concept. Simply put, objects contain data and the methods for working on that data.
There are three distinct advantages offered to the programmer by object-oriented programming. The first is program maintenance. Programs are easier to read and understand, and object-oriented programming controls program complexity by allowing only the necessary details to be viewed by the programmer. The second advantage is program alteration (adding or deleting features). It is possible to make additions and deletions to programs, such as in a database program, by simply adding or deleting objects. New objects can inherit everything from a parent object, and they only need to add or delete items that differ. The third advantage is that you can use objects numerous times. Well-designed objects can be saved in a toolkit of useful routines that can easily be inserted into new code with few or no changes to that code.
In the earlier chapters of this book, you probably discovered that you could convert many C programs to C++, and vice versa, by making simple program alterations. For example, printf is switched to cout for I/O streams. This is an easy switch because the conversion is from a procedure programming structure to a procedural programming structure. However, object-oriented programming is exclusively in the C++ realm because C does not provide the vital link—the abstract data type class. It is therefore more difficult to convert a procedure-oriented program to object-oriented form. Programs have to be reworked, with traditional functions being replaced with objects. In some cases, it turns out to be easier to discard the old program and create an object-oriented program from the ground up. This can be considered a distinct disadvantage.

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