C++ Introduction of C++ After the invension of c, it worked as a most popular structured programming language, which have multiple features used inside different and complex structure of other program but the concept of C was in procedure oriented, which means combination of multiple programs but the concept of variables in C represent their global declearation value where all programs can easily share their variables according to their necessity. But this feature to thread the security of programs and user can change the value of variable from any portion of program. So, it is necessary for programmer to introduce a concept where all variables are combined together and only function can be used according to the feature or declearation of crods. It is necessary too bind all the variables in a group and this concept is known as “Class”, where all function made publically open (called- Encapsulation). For increase the above feature Bjarne staroustrop, who was the developer of Simula 67 both. Simula 67 was the language who used the concept of Class and Variables are bind together but it was a object based language (not object oriented). In 1980, Bjarne staroustrop introduces a language, which created by the concept of Algol 68, Simula 67 and C. when it was developed, it introduced as “c with class”. In 1983, Risc Mascitte renamed as C++, after using the concept and format of increment operator ++. Introduction of Object Oriented language Object is the physical existance throughout all parts are instantiate together called Object. OOL A group of information where logical framnework are used to combine the instance variable.
Object oriented language made by the combination of Object and Class both, where Class is the logical frame work of all variables or parts which are instantiate together to create a function. We can say, Class is a blueprint or combination made by the behaviour of variable and function both, where an object is the physical existance of any Class through the output or functioon can be determine with the allocated memory area. For example- If a car is an object then its parts and function which are logically added inside it, is caalled Class. parts functions logical frame work when multiple parts and functions are combined through a logical frame work, called – Class and exist by Object. Key concept of Object Oriented Language/ Features of c++ a) Class b) Object c) Method d) Data abstraction e) Encapsulation f) Data binding g) Message passing h) Reusability/ Inheritance i) Polymorphism j) Contructor k) Deligation l) Genericity Explanationa) Class- A logical frame work of all parts and functions through informations are present in a group and no any individual informations can display without the permission of class. We can say, Class is a group of object which has identical properties to make or create a common behaviour of different functions. It allows the variables to work in private format and doesn’t move independently from the outside of function. Class can also allow the functions can make publically open.
b) c) d) e) f) g) h) Object-physical existence of any parts and functions is called Object. Object can represent their function and control the behavior of parts after rotates them in memory. Object is nothing but a memory area where all the information are stored simultaneously when it called or execute by translator or compiler. We can say, Object is a run time entity of object oriented concept. Method- All variables which are bind together by class can only called using the member function of class. These functions are the outcome of any program as a result. These functions are used to define the operation required by an object when coded in class, is called- Method/ Function. Data abstraction- In object oriented programming language, all parts are instantiate together and functions make publically open to represent the procedure without declared or include any background details, is called- Abstraction. Encapsulation- To prevent the variables from any unauthorized accessing or tempering, we must hide them where data are bind together but functions made publically open, is calledEncapsulation. Dynamic binding- Sometime it is necessary to run or change the value of information at run time. Binding means connecting of one program to other which executed when one program can call other. In this case, the code present in the specified program in hidden way till it called by compiler or executed. In this case, their program is in hidden way before execution is calledDynamic binding. Message passing- In object oriented programming; operations are passed by their functions and allocated by their declared objects, where objects are communicated by their class. In this format, object has different way for flow the information as message, where data are transformed from one object to other by declaring the class, by declaring the object from class by implementing an object to other. Reusability / Inheritance- The feature of Reusability can define how does a code can be written at once and used again and again. When the properties of one class can be easily called inside the other class without declaring any variable, is called Inheritance. All object oriented features are depending on the concept of different Inheritance category. In C++ / Java, supports different categories of Inheritance, they areI. Single Inheritance II. Multilevel Inheritance III. Hierarchical Inheritance IV. Multiple Inheritance V. Hybrid Inheritance VI. Multipath Inheritance Explanation: I. Single Inheritance- When a class can share their all properties with other class, is called Single Inheritance, where only relation of two classes is declared. The class which inherited by their sub class is called, Base class in C++ and Super class in Java.
In the class which inheriting the properties of their Base class is called Derived class and Sub class in Java. In Single Inheritance, the base and super class is inherited by their sub class but sub class have no authority to share their properties with super class. II. parent Base class child Devived class Multilevel Inheritance- When the super class share their properties with sub class and that sub class share their properties with other class, is called Multilevel Inheritance. In this Inheritance, the sub class behave like an intermediary, is called Intermediate class. For ex- A relation of grand parent, parent and child is defined as Multilevel Inheritance feature. Class A Base class Class B Intermediary class Class C Sub/derived class In this Inheritance, a class is behave like a sub class for their super class and super class for their sub class. III. Hierarchical Inheritance- When a single super class or base class inherited by different sub class, when a no of subclass is more than 1, is called Heirarchical Inheritance. Class A Class B Class C Class D