OBJECTS ENCAPSULATE STATE AND BEHAVIOUR
Can you clearly make out what this statement –“objects encapsulate state and behaviour”-
is trying to convey? No? Same problem was with me also but when I read it for
the first, go deep and you will find easy. Well let’s first discuss a term
called encapsulation, after which the above statement will become
clear to you. We shall also talk about linked term ”abstraction” to
understand it more clearly.
What is abstraction?
Abstraction is a concept of simplifying a real world concept
into its essential elements.
Abstraction refers to the act of
representing essential feature without including the background details or
explanations.
To understand abstraction let us take an example. Suppose
you are driving a car.You only know the essential features to drive a car i.e.
gear handling, steering handling,use of clutch, brakes,accelerator etc. But
while driving do you get into internal details of car like wiring, petrol tank,
motor workingetc. ? You just change the gear or apply the brakes etc. What is
happening inside is hidden from you. That what abstraction is, where you only
know the essential things to drive a car without including the background
details or explanations.
No comments:
Post a Comment