In this lesson, you will learn.
1. C++ is an object-oriented programming language developed by Bjarne Stroustrup in 1979 at the Bell Laboratories of American Telephone and Telegraph (AT&T) in the USA.
2. Initially, C++ was known as C with classes, and in 1984 it was renamed to C++, and in 1985 C++ was released for its commercial use as a first edition.
3. In 1991 its second edition was released and so on.
4. C++ is a general-purpose, compiled, low-level manipulation, and a case-sensitive programming language.
5. General purpose means it supports various uses, from microcontrollers to huge distributive commercial applications.
6. Compiled means it converts the source code directly to the optimized machine-understandable code that can execute very quickly.
7. Low-level manipulation means, it provides control over hardware, memory, and system resources, making it ideal for system programming.
7. C++ is an intermediate-level programming language as it contains the features of both high-level and low-level languages.
8. C++ follows the multi-paradigm programming model as it supports Procedural Oriented Programming(POP) and Object-Oriented Programming language (OOP).
9. It is an extension of the C programming language and hardware-independent as it is available for most computer machines.
10. C++ is a platform-dependent language.
Object-oriented programming (OOP) was developed due to limitations in earlier programming approaches. Let’s understand the need for OOP programming.
A programming paradigm is an approach to solving a problem known as a “programming style” or “programming techniques”.
As programs grow, the size of a single list of instructions becomes increasingly cumbersome. They have divided programs into smaller parts, later known as functions.
This function concept is used in C and C++. In other languages, the same concept may be referred to as a subroutine, a subprogram, or a procedure.) and may also be referred to as subroutine.
A procedural program is divided into functions, and (ideally, at least) each function has a clearly defined purpose and a clearly defined interface to the other functions in the program.
Breaking a program into functions can be expanded by grouping multiple functions into a larger module.
Dividing a program into functions and modules is one of the cornerstones of structured programming.
As programs become more complex, structured programming approaches may show strain, leading to disasters such as schedule slips, increased complexity, and increased costs (REfer The Mythical Man-Month by Frederick P. Brooks, Jr. [Addison Wesley, 1982])
There are two related problems.
First, functions have unrestricted access to global data. Second, unrelated functions and data, the basis of the procedural paradigm, provide a poor model of the real world.
Local data is defined within a function and can be accessible by that function only while data must be defined as global when two or more functions want to access the data.
In a large program, there are many functions and many global data items. The problem with the procedural paradigm is that this leads to an even larger number of potential connections between functions and data.
The large number of connections in a program makes its structure and modification difficult, as changes in a global data item may require rewriting all access functions.
For example, change product codes in the inventory program from 5 digits to 12 digits, requiring data type change from short to long, modifying all functions to handle long data.
The second and more important problem is, that the procedural paradigm’s arrangement of separate data and functions fails to accurately model real-world objects.
In the physical world, we deal with objects such as people and cars. Such objects aren’t like data and they aren’t like functions. Complex real-world objects have both attributes and behavior.
Attributes are equivalent to the data in the real world and are also known as characteristics. For people, the name, weight, eye color, etc, and for cars, the number of doors, hp, engine type and have a certain value.
Behavior is something the action where an object responds to some stimulus. Like, if your boss asks you something to do, so your response may be “yes” or “no”. Second, you will apply a brake in a car.
Behavior is like a function to do something.
So neither data nor functions, by themselves, model real-world objects effectively.
So, that is the need for object-oriented programming. The object-oriented programming will be discussed in the upcoming lesson.
There is a typo in Introduction to C++ (point 7 is repeated).
You must be logged in to submit a review.