Seven qualities to be satisfied for a programming language to be pure Object Oriented
- Encapsulation/Data Hiding: Bundling data and method (operation) into a single unit, like in capsule we can have multiple ingredients. For example in a class we have member variable and method and these variable can work with the methods as a single unit.
- Inheritance Creating class which can use an existing class and can use variables and methods from that class. The class which is using another class is called as Child class and the other class is called as Parent class. Here Child class inherits parent class.
- Polymorphism English meaning of Polymorphism is many forms, for example a man can be father, brother and son at the same time. In programming we can have multiple methods with same name but different input parameters like sum(int a, int b) or sum(int a, int b, int c) or sum(float a, float b). It has two types Compile time Polymorphismand Runtime polymorphism. Example of compile time polymorphism is function overloading and operator overloading. for example sum(int a, int b) or sum(int a, int b, int c) or sum(float a, float b) is function overloading or method overloading.
- Example of runtime polymorphism is Overriding here suppose we have a class Employee which is a parent class and has a method CalculateSalary () we have another class ContractEmployee which inherits Employee class and has a method with same name CalculateSalary() here this is called as Overriding.
- All predefined types are objects
- All operations are performed by sending messages to objects
- All user defined types are objects.