Introduction to C++
C++, as we all know is an extension to C language and was developed by Bjarne stroustrup at bell labs. C++ is an intermediate level language, as it comprises a confirmation of both high level and low level language features. C++ is a statically typed, free form, multiparadigm, compiled general-purpose language.C++ is an Object Oriented Programming language but is not purely Object Oriented. Its features likeFriend and Virtual, violate some of the very important OOPS features, rendering this language unworthy of being called completely Object Oriented. Its a middle level language.
Benefits of C++ over C Language
The major difference being OOPS concept, C++ is an object oriented language whereas C language is a procedural language. Apart form this there are many other features of C++ which gives this language an upper hand on C laguage.Following features of C++ makes it a stronger language than C,
- There is Stronger Type Checking in C++.
- All the OOPS features in C++ like Abstraction, Encapsulation, Inheritance etc makes it more worthy and useful for programmers.
- C++ supports and allows user defined operators (i.e Operator Overloading) and function overloading is also supported in it.
- Exception Handling is there in C++.
- The Concept of Virtual functions and also Constructors and Destructors for Objects.
- Inline Functions in C++ instead of Macros in C language. Inline functions make complete function body act like Macro, safely.
- Variables can be declared anywhere in the program in C++, but must be declared before they are used.
What is C++
C++ is a general purpose, case-sensitive, free-form programming language that supports object-oriented, procedural and generic programming.C++ is a middle-level language, as it encapsulates both high and low level language features.
Usage of C++
By the help of C++ programming language, we can develop different types of secured and robust applications:- Window application
- Client-Server application
- Device drivers
- Embedded firmware etc
C++ and Object Oriented Programming
C++ supports the object-oriented programming, the four major pillar of object oriented programming used in C++ are:- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
Standard Libraries
Standard C++ programming is divided into three important parts:- The core library includes the data types, variables and literals, etc.
- The standard library includes the set of functions manipulating strings, files, etc.
- The Standard Template Library (STL) includes the set of methods manipulating a data structure.
C vs C++
No. | C | C++ |
---|---|---|
1) | C follows the procedural style programming. | C++ is multi-paradigm. It supports bothprocedural and object oriented. |
2) | Data is less secured in C. | In C++, you can use modifiers for class members to make it inaccessible for outside users. |
3) | C follows the top-down approach. | C++ follows the bottom-up approach. |
4) | C does not support function overloading. | C++ supports function overloading. |
5) | In C, you can't use functions in structure. | In C++, you can use functions in structure. |
6) | C does not support reference variables. | C++ supports reference variables. |
7) | In C, scanf() and printf() are mainly used for input/output. | C++ mainly uses stream cin and cout to perform input and output operations. |
8) | Operator overloading is not possible in C. | Operator overloading is possible in C++. |
9) | C programs are divided intoprocedures and modules | C++ programs are divided into functions and classes. |
10) | C does not provide the feature of namespace. | C++ supports the feature of namespace. |
11) | Exception handling is not easy in C. It has to perform using other functions. | C++ provides exception handling using Try and Catch block. |
No comments:
Post a Comment
Please write your view and suggestion....