Need of C++
- It is very difficult to apply structured programming language like C to solve the complex problem and model the real world problems perfectly.
- To overcome such complexity, the programmers find the need of C++ and then C++ was developed.
Features of C++
1. Namespace
It is used for logical grouping of program elements. It helps to develop large application by different members of the team independently without conflict of identifiers name.
2. Class
It is user defined data types that combines data and function together.
3. Derived class
It is new class formed from existing classes which ensures code reuasbility.
4. Access controller
Private, public and protected keywords control the access of members within the class.
5. Constructor and Destructor
A constructor is used to allocate required memory for members and initialize the objects of its class. It has the same name as of its class.
A destructor complements the operation of constructor. It has same name as of its class but preceded by tilde (~) symbol.
6. Friend function and class
Friend function is used to access even the private members of a class. In other to access hidden members of a class, by another class, the class must be declared as friend class.
7. Reference variable
It is useful to pass arguments by reference.
8. Function Overloading
When same function name is used for different operation, it is called function overloading. It is used to manipulate same nature of problems but with different numbers of arguments.
9. Default argument
Default argument come into action when no any arguments are passed during a function call.
10. Inline function
The function body put directly in the called location to reduce execution time.
11. Operator overloading
It extends the meaning of an operator for user defined type.
12. Easier memory management
C++ provides 'new' operator for dynamic memory allocation and 'delete' operator for dynamic memory deallocation.
13. Stream class library
Header files declare stream class, functions and declarations.
14. Run time polymorphism
The member function of a class can be selected at run time.
15. Exception handling
Exception are the errors during run time.
16. Run time type information (RTTI)
It is mechanism that allows the type of an object to be determined during program execution. The elements of RTTI are dynamic_cast, type id operator and type_info class.
C++ vs C
C | C++ |
|
|
History of C++
- In 1967, Simula and BCPL
- In 1978, B; then K and RC; then Classic C
- In 1980, C with classes
- In 1985, Early C++ , C89
- In 1989, ARM C++
- In 1998, C++ 98, C99
-by SURAJ AWAL
Ⓒ Copyright ESign Technology 2019. A Product of ESign Technology. All Rights Reserved.