What is OOPs ?
Answer in technical term is Object-oriented programming System(OOPs) is a programming paradigm based on the concept of “objects” that contain data and methods. … Object oriented programming brings together data and its behavior(methods) in a single location(object) makes it easier to understand how a program works.
Okay only 25 % of people can understand this term in this language so lets simplify this :
This is hard for me first but when I participate in the July edition workshop of Crio.Do it becomes simple for me as they are giving real life examples .
Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data.
An Object is a collection of data members and associated member functions also known as methods.
Objects with similar properties and methods are grouped together to form a Class. Thus a Class represent a set of individual objects. Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects becomes functions of the class and is referred to as Methods.
An architect will have the blueprints for a house….those blueprints will be plans that explain exactly what properties the house will have and how they are all layed out. However it is just the blueprint, you can’t live in it. Builders will look at the blueprints and use those blueprints to make a physical house. They can use the same blueprint to make as many houses as they want….each house will have the same layout and properties. Each house can accommodate it’s own families…so one house might have the Smiths live in it, one house might have the Jones live in it.
The blueprint is the class…the house is the object. The people living in the house are data stored in the object’s properties.
Abstraction means showing essential features and hiding non-essential features to the user.
For Eg. Tv Remote..
Remote is a interface between user and TV..right. which has buttons like 0 to 10 ,on /off etc but we don’t know circuits inside remote.User does not need to know.Just he is using essential thing that is remote.
Encapsulation = Abstraction + Data Hiding.
Its is done for security purposes .
A car is having multiple parts..like steering,wheels,engine…
etc..which binds together to form a single object that is car. So, Here multiple parts of cars encapsulates itself together to form a single object that is Car.
Deriving a new class from the existing class,is called Inheritance.
Derived(sub class) class is getting all the features from Existing (super class\base class) class and also incorporating some new features to the sub class.
Ability to take more than one form that an operation can exhibit different behavior at different instance depend upon the data passed in the operation.
if a girl is married and mother of 2 children doing teaching job then she is a women first , teacher in a school when she is in school,wife of someone at home,, mother of her children,, and obvious daughter of someone .
This is an example of Polymorphism.
https://crio.do/ help me a lot in learning OOps fundamentals and they will help you too.
And They have motto of Learn by Doing and i get this because of this motto.
They have Micro-Experience projects which help me to make my weak concept hard .
We have talked about OOPs fundamentals Like Polymorphism,Encapsulation,Inheritance and classes with their respective examples.
Thanks For Reading!
Top comments (0)