C++ is general purpose, high level, compiled, case-sensitive and object-oriented programming language. C++ language was developed by using C language developed in 1972 by Dennis Ritchie at Bell Laboratories. Called as mother of all languages C language has its own impact from birth. It is also known as POP(Procedure Oriented Programming Language). C++ language developed in 1980 by Bjarne Stroustrup at Bell Laboratories. C++ language is called as Object Oriented Programming Language(OOP).
Features of C++ :
- Simple:
C++ is the basic and simple programming language. It is easy to understand for beginners of a developer. If you want to learn and get more knowledge then you can join C++ classes in pune.
- Middle-level Programming Language:
It is also used in low level as well as a high level programming language. It is also used to develop system application.
- Structured Programming Language:
C++ language is a structured programming language. In that, we can break the part of a program in function and it is easy to modify and edit.
- Pointer:
We can say Pointer as the best features in c++ language. By using pointer we can directly interact with the memory.
- Speed:
The Speed of compiling and execute of c++ is fast.
- Object Oriented:
C++ is Object Oriented programming language. It is Easy to develop and maintenance were Procedure Oriented programming language and it is not easy when code grows.
- Recursion:
It is used to provide code reusability for every function. It is call function within a function.
- Memory Management:
Another best feature of C++ language is Memory Management. In C++, support dynamic memory allocation. We can assign free memory allocation by using free() function.
Below Introduce the first program in C++ programming
- #include<iostream.h> includes standard input/output library function. Also, it provides cin and cout methods for reading form input and writing to output.
- #include<conio.h> includes the console input/output library function.
- void main() It function is used to an entry point in every c++ program and it void keywords specify no return value.
- cout<<”…” is used to print data and display on the window.
- getch(); is used to ask single character.
Inheritance in C++ Language:
Inheritance is nothing but a process of a new class can acquire the properties and behaviour of existing class. The new class which is created is called as “Derived Class” and The the class which already exist is called as “Base Class”.
In Object-oriented Programming, Inheritance is the most important concept. It improves your time to implement code by reducing code in your projects. Inheritance implements “IS-A” relationship.
Types of Inheritance
In types of inheritance, there are three access specifiers Public, Protected and Private. We hardly use “Private” and “Protected” access specifier and “Public” is by default and commonly used.
In C++, 5 different type of Inheritance:
- Single Inheritance
- Multiple Inheritance
- Multi-Level Inheritance
- Hierarchical Inheritance
- Hybrid Inheritance
Single Inheritance:
This is the very simple type of inheritance. In this type, One derived class inherits from one base class.
Multiple Inheritance:
In multiple inheritance single derived class may inherits from two or more base class.
Multi-Level Inheritance:
Multi-Level Inheritance called as one class inherits another class which is further inherits another class.
Hierarchical Inheritance:
Hierarchical Inheritance means multiple derived classes inherits from single base class.
Hybrid Inheritance:
The combination of hierarchical and hybrid inheritance is known as Hybrid Inheritance.