Object Oriented Programming mainly deals with concepts such as Abstraction, Encapsulation, Polymorphism, Inheritance.


Abstraction:

  • Abstraction mainly involves extraction of only relevant information.
  • The concepts of abstraction and encapsulation mainly deals with the member functions of the class.
  • abstraction can be explained in other words as ' Looking for what u want ' in an object or a class.
  • after reading this summary of abstratcion one gets a doubt " does abstraction mean that information is unavailable" .....! No, It means that all the information exists, but only the relevant information is provided to the user.
  • we shall learn more abt abstraction by considering the below given example...
example:

Anautomobile salesperson is aware that different people have different preferences. Some r intrested in the mileage of the car, some in its price, some in its engine, and some in its style.

So every individual have diffferent views and wants . Although every individual is intrested in diff aspects of the car finally tey all come to the category of buying a car. The sales man knows the details of the car , but he presents only the relevant information to potential to the customer. As a result, the salesman practices abstraction and presents only relevant details to customer.


Encapsulation:

  • Encapsulation means packing of one or more components together.
  • It short encapsulation means ' to enclose it or as if in a capsule' .
  • Encapsulation can be defined as " the process of enclosing one or more items within a physical or logical package ", it involves preventing access to non-essential data.
example:

When you plug in the cord of a vacuum cleaner and turn on the switch, the vacuum cleaner starts. You do not see the complex process needed to actually convert electricity into suction power. In other words , the exact working of the cleaner has been encapsulated. Therefore, encapsulation is also explained as information hiding or data hiding because it involves hiding many of the important details of an object from the user.

Abstraction and encapsulation are realated features. abstraction enables you to make relevant information visible. Encapsulation enables you to package information to impent the desired level of abstaraction. Therefore, encapsulation assists abstraction by providing a means of suppressing the non essential details.
the feature of encapsulation is achieved by access specifiers............

2 Comments:

  1. Zephyr Girl said...
    Hi Friend,
    Nice to read ur post.
    gud info.....
    i would like to share my link with ur blog.
    visit my cycadelia.blogspot.com
    Zephyr Girl said...
    visit my profile to know about me.
    regards,
    zephyr girl

Post a Comment



Newer Post Older Post Home