Home | » | C++ Programming | » | Introduction to C++ |
C++ is an extension to C Programming language. It was developed at AT&T Bell Laboratories in the early 1980s by Bjarne Stroustrup. and started as extension to C (macros and variables) added new useful, features nowadays a language of its own C++ (the next thing after C, though wouldn't ++C be more appropriate?)
Contents
History of C++
C++, and extension of C, was developed by Bjarne Stroustrup in the early 1980s at Bell Laboratories. C++ provides a number of features that upgrade the C language, but more importantly, it provides the capabilities for object-oriented programming. In short we say that C++ has all the capabilities of C plus its own feature as independent OOPS oriented programming approach.
There is a revolution grewing in the software community. Buliding software quickly, correctly and economically remains an elusive goal, and this at a time when the demand for new and powerful software is soaring. Objects are essentially reusable software components that model items in the real world.
Object Oriented Programming
The Fundamental idea behind the object oriented languages is to combine into a single unit both data and the functions that operate on that data. Such a unit is called an object.
An object's functions, called member functions in C++ typically provide the only way to access us data. If you want to read a data item in an object, you call a member function in the object. It will read the item and return the value to you. You can't access that data directly. The data is hidden, so it is safe from accidental alteration. Data and its functions are said to be encapsulated into a single entity. Data encapsulation and data hiding are key terms in the description of object oriented languages.
Relation Between C And C++
C++ is and extensive version of C language. In other words, C++ is derived from C. It was originally called as C with classes. C++ can also be considered as a new language that supports almost all the syntax of C. C++ is built on C because of C's suitability to system programming. C++ OOP aspect was inspired in early 1980's by Bjarne Stroustrup. The diagrammatical view, differentiating the C++ from C is given below:
OOP Characteristic Of C++
Object Oriented Programming has few major components such as object and class. Based on the objects and classes the features of inheritance, encapsulation, data abstraction, reusability and polymorphism are implemented. The following briefs the idea of these features of OOP.
Object
An Object is a Real Word Thing Which performs a Specific Task and which has a set of Properties and Methods. Properties of Object are Also Called as Attributes of an Object and Method is also Known as the Function of the Object Like What an Object can do For Example A Car is an Object which has a Certain Number of Properties Like Color, Model No, Average etc and a Function Known as Run When A User gives Some Race then the Car Will be Moved
Class
A Class is that which contains the set of properties and Methods of an object in a single unit Like Animals is name of class which contains all the Properties and Methods of an Object of another Animals So if we wants to access any data from the Class then first we have to create the Object of a class Then we can use any data and method from class
Encapsulation
Data Encapsulation is also Known as Data Hiding as we know with the inheritance concept of Opps a user can use any code that is previously created but if a user wants to use that code then it is must that previously code must be Public as the name suggests public means for other peoples but if a code is Private then it will be known as Encapsulate and user will
not be able to use that code So With the help of OPPS we can alter or change the code means we can make the Code as Private or public This allows us to make our code either as public or private.
Data Abstraction
Data Abstraction is that in which A User Can use any of the data and Method from the Class Without knowing about how this is created So in other words we can say that A user can use all the Functions without Knowing about its detail For Example When a User gives Race to Car The Car will be Moved but a User doesn't know how its Engine Will Work.
Inheritance
Inheritance is very popular Concept in OOP This provides the Capability to a user to use the Predefined Code or the code that is not created by the user himself but if he may wants to use that code then he can use that code This is Called Inheritance but Always Remember in Inheritance a user only using the code but he will not be able to change the code that is previously created he can only use that code.
Reusability
Once a class created, it can be made available to other program, so that repetition of work can be reduced. This concept of availing the use of existing class is called reusability. Inheritance follows the concept of reusability.
Polymorphism
Poly Means many and morphism means many function The Concepts Introduces in the form of Many behaviors of an object Like an Operator + is used for Addition of Two Numbers and + is also used for Joining two names The Polymorphism in java Introduces in the Form of Functions Overloading and in the Form of Constructor Overloading