Building Classes in C++  «Prev  Next»
Lesson 2 Object-oriented programming
Objective Basic concepts behind object-oriented programming.

Object-Oriented Programming in C++

Object-oriented programming (OOP) is a balanced approach to writing software in which data and behavior are packaged together. This encapsulation creates user-defined types, extending and interacting with the native types of the language.

The term OOP refers to a collection of concepts, including the following:
  1. User-defined types can be easily created and used.
  2. Implementation details of user-defined types are hidden.

With OOP, the programming task is frequently more difficult than normal procedural programming, such as in C.
There is at least one extra design step before you get to the coding of algorithms. This extra step involves the design of types that are appropriate for the problem at hand. Frequently, you must solve a problem more generally than is strictly necessary.
The belief is that this will pay dividends in several ways:
  1. The solution will be more self-contained and thus, more robust and easier to maintain and change.
  2. The solution will be more reusable.