4 Basics of Object Oriented Programming.
Before move into 4 basics of OOP, let’s consider what is Object Oriented Programming(OOP).
So, There are two types of programming styles. One is function oriented programming and other one is object oriented programming. But in here, We are going to talk about Object Oriented Programming(OOP).
Simply, OOP is a a Programming Style — in which multiple lines of code is wrapped into small small modules(classes, methods etc.).
Again if we move back to main topic, The 4 basics of OOP defines the proper management policies to manage classes in the software system.
So, Here are the 4 main gods of OOP,
Abstraction is the the process of hiding the functional style of an object and displaying only the required information of the object in an understandable way.
for an example, We all know how to turn on the TV, But we don’t need to know how it works, Simply because we don’t need to know all that complexity. Our job is to only turn on the TV. That’s what we called Abstraction.
Encapsulation is wrapping up properties and methods in to a single unit called class. Then it automatically achieve the concept of data hiding by providing security to data by making the properties as private and expose the property to access the private data which would be public.
If we think about encapsulation through our school bag, We keep every thing like books, pens, articles and many more in it. So in order to keep those stuff safe we are putt those in to the bag and zip up. Similarly in OOP we encapsulate the attributes and functions inside the class to keep it safe and accessible only to authorized member.
Inheritance is a ability to create new class from an existing class. Then the class that created from an existing class can inherit the attributes and methods from that parent class.
The real time example for inheritance is our smartphone calculator. If we need to have the scientific calculator we need to rotate our phone to landscape mode. By this we can access to scientific calculator. So when we rotate our phone it automatically inherit the normal calculator basics and add more features and build a new calculator object.
Polymorphism means “many shapes” in Greek. So polymorphism lets programmers use the same word to mean different things in different contexts. There are two forms as method overloading and method overriding. Method overriding happens on different classes and method overloading happens in same class.
For an example twin brothers looks alike but they hold different characters.
So that’s all about 4 concepts of OOP in simplest way. This is just for getting the small idea of how these concepts work.
And this is my first technical blog post. Therefore, I kindly request you to point out any shortcomings, errors or corrections here.
Thank you very much.