Learn:
What are the concepts of Object Oriented Programming Systems (OOPS) in C++ programming language?
Brief description of Class, Object, Inheritance, Data Encapsulation, Data Abstraction and Polymorphism.
OOPS stands for "Object Oriented Programming System" in C++ programming, Here we are discussing about the concepts of OOPS (or main features of OOPS).
There are following concepts of OOPS:
Class
Object
Inheritance
Data Encapsulation
Data Abstractions
Polymorphism
1) Class
Class is the template of an object. That logically encapsulates data members and member functions into a single unit. Classes are data type based on which objects are created.
2) Object
Object is a basic unit of OOPS. It has unique name. An object represents a particular instance of a class. We can create more than one objects of a class. The size of class is size of total number of data members of class.
3) Inheritance
Inheritance is the process of creating new class from existing class or base class. By using the concept of Inheritance, we can use implemented (existing) features of a class into another class).
Base class is also known as parent class or super class. The new class that is formed is called derived class. The derived class is also known as sub class or child class. Inheritance is basically used for reducing the overall code size of the program.
4) Data Encapsulation
Data encapsulation combines data members and member functions into a single unit that is called class. The advantage of encapsulation is that data cannot access directly. It is only accessible through the member functions of the class.
5) Data Abstraction
Data abstraction specifies hiding the implementation detail for simplicity. It increases the power of programming language by creating user define data types.
6) Polymorphism
Polymorphism is basic and important concept of OOPS. Polymorphism specifies the ability to assume several forms. It allows routines to use variables of different types at different times. In C++, an operator or function can be given different meanings or functions. Polymorphism refers to a single function or multi-functioning operator performing in different ways.
Used to pass current object as a parameter to another method.
Used to refer current class instance variable
Used to declare indexers
Inheritance is an is-a relationship. We use inheritance only if an is-a relationship is present between the two classes.
Here are some examples:
A car is a vehicle.
Orange is a fruit.
A surgeon is a doctor.
A dog is an animal.