Page 21 - CA_Blue( J )_Class9
P. 21

1.3.2 Data Abstraction
                 The word abstract means existing in thought as an idea but does not have a tangible existence. Data Abstraction
                 is the property by which the essential features of a class are represented without informing about the background
                 details, i.e., non-essential details are hidden from the user.
                 For example, while travelling in a car as a passenger, you think only of
                 reaching the  destination.  But you never  think of how  the  driver  is
                 driving the car by pressing the clutch, brake and accelerator as and
                 when required. Similarly, in case of the driver, he is only concerned
                 about the steering wheel, accelerator, clutch and brake. But he is least
                 interested in how they execute their functions.
                                   Similarly, the key purpose of abstraction in OOP is to hide the details that are not required by
                                   the users. Abstraction is like a query passed to a database which extracts the required data
                                   only leaving the rest. The main purpose is to reduce the programming complexity. It is one of
                                   the most important concepts of OOPs.
                                   Let us understand with another example, while using an Automated Teller Machine (ATM),
                                   we only concentrate on executing the operations like cash withdrawal which includes
                                   inserting the card, typing the PIN and amount of cash, etc. But we never think of how
                                   exactly that operation is executed internally, so that we could get the service correctly.
                                   Thus, it is a real-life example of abstraction as the detailed functioning of the ATM is hidden
                                   from the user.


                 1.3.3 Difference between Abstraction and Encapsulation

                                       Abstraction                                  Encapsulation
                      Issues at the design level can be solved.      Issues at the implementation level can be solved.

                      Abstraction is about hiding unwanted details and  In encapsulation, the methods and data are kept
                      showing only the essential information.        in a single unit.

                      Abstraction focuses on what the information object  It hides the internal details of how an object does
                      must contain  and present to the outside world.  something for security reasons.


                 1.3.4 Inheritance
                 The procedure of generating a new class with the help of a class already created by using its properties and
                 functionality is said to be inheritance. It is one of the important pillars of Object-Oriented Programming.

                 For example, in real world, a child inherits the properties (both materialistic and non-materialistic) of its parents,
                 who, in turn, inherited them from their parents.






















                                                                          Principles of Object-Oriented Programming  19
   16   17   18   19   20   21   22   23   24   25   26