C++ Fundamentals
This tutorial describes the fundamental characteristics of the object-oriented C++ programming language. In addition, you will be introduced to the steps necessary for creating a fully functional C++ program. The examples provided will help you retrace these steps and also demonstrate the basic structure of a C++ program.
DEVELOPMENT AND PROPERTIES OF C++ |
Historical Background:
The C++ programming language was created by Bjarne Stroustrup and his team at Bell Laboratories (AT&T, USA) to help implement simulation projects in an object-oriented and efficient way. The earliest versions, which were originally referred to as "C with classes” date back to 1980.
As the name C++ implies, C++ was derived from the C programming language: ++ is the increment operator in C.
As early as 1989 an ANSI Committee (American National Standards Institute) was founded to standardize the C++ programming language. The aim was to have as many compiler vendors and software developers as possible to agree on a unified description of the language in order to avoid the confusion caused by a variety of dialects. In 1998 the ISO (international organization for Standardization) approved a standard for C++ (ISO/IEC 14882).
As the name C++ implies, C++ was derived from the C programming language: ++ is the increment operator in C.
As early as 1989 an ANSI Committee (American National Standards Institute) was founded to standardize the C++ programming language. The aim was to have as many compiler vendors and software developers as possible to agree on a unified description of the language in order to avoid the confusion caused by a variety of dialects. In 1998 the ISO (international organization for Standardization) approved a standard for C++ (ISO/IEC 14882).
: for more information read here - Wikipedia
Characteristics of C++ :
C++ is not a pure object-oriented language but a hybrid that contains the functionality of the C programming language.
This means that you have all the features that are available in C:
- universally usable modular programs
- efficient, close to the machine programming
- portable programs for various platforms
The large quantities of existing C source code can also be used in C++ programs.C++ supports the concepts of object-oriented programming (or OOP for short), which are:
- data abstraction, that is, the creation of classes to describe objects
- data encapsulation for controlled access to object data
- inheritance by creating derived classes (including multiple derived classes)
- polymorphism (Greek for multiform), that is, the implementation of instructions that can have varying effects during program execution.
Traditional Concept :
Traditional Procedural programming |
Object-Oriented Concept :
Object-Oriented programming |
Traditional Procedural Programming :
In traditional, procedural programming, data and functions (subroutines, procedures) are kept separate from the data they process.
This has a significant effect on the way a program handles data:
- the programmer must ensure that data are initialized with suitable values before use and that suitable data are passed to a function when it is called
- if the data representation is changed, e.g. if a record is extended, the corresponding functions must also be modified. Both of these points can lead to errors and neither support low program maintenance requirements.
Objects :
Object-oriented programming (OOP) shifts the focus of attention to the objects, that is, to theaspects on which the problem is centered.A program designed to maintain bankaccounts would work with data such as balances, credit limits, transfers, interest calcula-tions, and so on. An object representing an account in a program will have propertiesand capacities that are important for account management.
OOP objects combine data (properties) and functions (capacities). A class defines acertain object type by defining both the properties and the capacities of the objects ofthat type. Objects communicate by sending each other “messages,” which in turn activate another object’s capacities
Advantages of OOP :
Object-oriented programming offers several major advantages to software development :- reduced susceptibility to errors: an object controls access to its own data. More specifically, an object can reject erroneous access attempts
- easy re-use: objects maintain themselves and can, therefore, be used as building blocks for other programs
- low maintenance requirement: an object type can modify its own internal data representation without requiring changes to the application
Post a Comment