In interviews, young programmer are asked for a real world scenario explaining OOP and many fail to answer. This is the reason I am writing this article. This article is mainly intended for the audience who knows the Object Oriented Programming (OOP) concept theoretically but are unable to link it with real world & programming world.
We write programs to solve our problems and get our work done.
Object Oriented Programming is considered as a design methodology for building non-rigid software. In OOPS, every logic is written to get our work done, but represented in form of Objects. OOP allows us to break our problems into small unit of work that is represented via objects and their functions. We build functions around objects.
There are mainly four pillars (features) of OOP. If all of these four features are presented in programming, the programming is called perfect Object Oriented Programming.
Let's consider an example explaining each of these pillars so you can better understand Object Oriented Programming.
Before that, we need to know something.
When we think of a mobile phone as an object, its basic functionality for which it was invented were Calling & Receiving a call & Messaging. But now a days thousands of new features and models were added and the features and number of models are still growing.
In above diagram, each brand (Samsung, Nokia, IPhone) have their own list of features along with basic functionality of dialing, receiving a call and messaging.