Home > Articles > Programming > C#

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

From C to C++ and Object-Oriented Programming

Simply stated, C++ is a superset of the C language. C++ retains all of C's strengths, including its power and flexibility in dealing with the hardware/software interface; its low-level system programming; and its efficiency, economy, and powerful expressions. However, C++ brings the C language into the dynamic world of object-oriented programming and makes it a platform for high-level problem abstraction, going beyond even Ada in this respect. C++ accomplishes all of this with a simplicity and support for modularity similar to Modula-2, while maintaining the compactness and execution efficiency of C.

This new hybrid language combines the standard procedural language constructs familiar to so many programmers and the object-oriented model, which you can exploit fully to produce a purely object-oriented solution to a problem. In practice, a C++ application can reflect this duality by incorporating both the procedural programming model and the newer object-oriented model. This biformity in C++ presents a special challenge to the beginning C++ programmer; not only is there a new language to learn, but also a new way of thinking and problem solving.

Not surprisingly, C++ has an origin similar to C's. While C++ is somewhat like BCPL and Algol 60, it also contains components of Simula 67. C++'s ability to overload operators and its flexibility to include declarations close to their first point of application are features found in Algol 60. The concept of subclasses (or derived classes) and virtual functions is taken from Simula 67. Like many other popular programming languages, C++ represents an evolution and refinement of some of the best features of previous languages. Of course, it is closest to C.

Bjarne Stroustrup, of Bell Labs, is credited with developing the C++ language in the early 1980s. (Dr. Stroustrup credits Rick Mascitti with the naming of this new language.) C++ was originally developed to solve some very rigorous event-driven simulations for which considerations of efficiency precluded the use of other languages. C++ was first used outside Dr. Stroustrup's language group in 1983, and by the summer of 1987, the language was still going through a natural refinement and evolution.

One key design goal of C++ was to maintain compatibility with C. The idea was to preserve the integrity of millions of lines of previously written and debugged C code, the integrity of many existing C libraries, and the usefulness of previously developed C tools. Because of the high degree of success in achieving this goal, many programmers find the transition to C++ much simpler than when they first went from some other language, such as FORTRAN to C.

C++ supports large-scale software development. Because it includes increased type checking, many of the side effects experienced when writing loosely typed C applications are no longer possible.

The most significant enhancement of the C++ language is its support for object-oriented programming (OOP). You will have to modify your approach to problem solving to derive all of the benefits of C++. For example, objects and their associated operations must be identified and all necessary classes and subclasses must be constructed.

Once again, C#, the ancestor to C and C++, absorbs the best of C++'s object-oriented problem solving capabilities. However, C#'s approach is a little less intimidating by eliminating multiple-inheritance between a parent/base/or root object and its descendants.

  • + Share This
  • 🔖 Save To Your Account