OOPs in real world !
Object oriented programming is programming paradigm which is widely used to develop complex Applications.
Object Oriented Programming
Object oriented programming have four pillars:-
Inheritance is one of the pillar of Object Oriented Programming language. In programming perspective it provides reusability. For example Cats can have same name , same color, same size and same name. But they are not same , they are Identical. Another example of inheritance is that a son gets the properties of his father and a father as a son gets the properties of his father. Thus, a son also gets the properties of his father as well as his grand father.
In real world, Abstraction means hiding internal details. For example, when you drive a car you know how to apply breaks, gears, accelerator, etc. but you don't how it is working internally. It does not show inside process of how it is doing things. Implementation parts are hidden. i.e. internal details are hidden.
Encapsulation is a concept of Object Oriented Programming language. In simple words encapsulation means binding multiple things into a single one. For example a college or university have multiple types of courses and department. Multiple courses makes a department such as BCA, MCA, BS,MS, etc. considered as Science Department and multiple departments such Science Department, Educational Department, Literature Department, Commerce Department, etc. makes college or university. In programming perspective class binds data members(variables) and member functions(methods) into a single unit.
Polymorphism is one of the concept of Object Oriented Programming language. The word polymorphism is made up of two words poly and morphsim. "Poly" means many and "morphism" means forms. Thus, polymorphism means something have many forms at the same time for instance A man can be a father, brother, husband, son, employee, etc. at the same time. In programming perspective polymorphism are of two types.
- Runtime Polymorphism
- Compile Time Polymorphism