Quick Introduction to C++ Features

C++ is a multi paradigm programming language, which means that it supports not only a single style of programming, but several styles that can be used as the need arises. Programmers have the decision on how to use the facilities provided by C++.

A number of programmers, specially the ones starting on C++, may decide to use C++ as a better C. This means that they can use C++ as a procedural language, using basically the same style of the C language, added by some improved features such as const modifiers and better type checking.

However, if you decide to use the full power of C++, you should better try to master the more sophisticated idioms provided by object oriented programming. In fact, one of the motivations for the creation of C++ was the introduction of object oriented features into the language.

Object orientation is a style of programming where the objective is to reduce the separation between data and functions, that is so common on procedural programming. With object orientation, programming is targeted at smaller units, called classes, which can be used to define entities that cooperate to make the program work. These entities, called objects, are defined by classes in the same way that variable may be defined by a struct definition.

With object oriented features, C++ provides all the power of the modular design allowed by objects and classes.

A class is the object oriented analogous to a C struct. Within the context of a class, the programmer can define data (as in a struct) and operations to manipulate the data.

An object in C++ is a variable that is created from a class and follows the rules defined by the class. It is similar to a variable created from a struct, but it follow some additional rules that are enforced by the object oriented paradigm.

Tags: C, programming, introduction
Article created on 2010-01-02 20:33:05

Post a comment