Pillars of OOPS
1. Encapsulation
Encapsulation is wrapping up the data and methods together within a single entity. In C++, classes are used for encapsulation.
2. Abstraction
Showing only the necessary details and hiding the internal details is known as abstraction.
3. Polymorphism
Providing different functionalities to the functions or operators of the same name is known as Polymorphism.
Types of Polymorphism
- Compile-time Polymorphism
- Runtime Polymorphism
Compile-time Polymorphism can be achieved using:
- Operator overloading
- Function overloading
Runtime Polymorphism can be achieved using:
- Function overriding
- Virtual Functions
4. Inheritance
Deriving the properties of a class ( Parent class ) to another class ( Child class ) is known as Inheritance. It is used for code reusabilty.
Types of Inheritance:
- Single Inheritance: When a derived class inherits the properties of a single base class, it is known as Single Inheritance.
- Multiple Inheritance: When a derived class inherits the properties of multiple base classes, it is known as Multiple Inheritance.
- Multilevel Inheritance: When a derived class inherits the properties of another derived class, it is known as Multilevel Inheritance.
- Hierarchical Inheritance: When more than one derived class inherits the properties of a single base class, it is known as Hierarchical Inheritance.
- Hybrid (Virtual) Inheritance: When we combine more than one type of inheritance, it is known as Hybrid (Virtual) Inheritance. Example: Combining Multilevel and Hierarchical inheritance.
C++ Cheatsheet
This is a C++ programming cheat sheet. It is useful for beginners and intermediates looking to learn or revise the concepts of C++ programming. While learning a new language, it feels annoying to switch pages and find different websites for different concepts that are easily understandable. You can learn C++ concepts very easily using this cheat sheet.
C++ is a high-level programming language. It was developed in 1983 by Bjarne Stroustrup at Bell Labs. It is used for developing various applications.
Contact Us