Page 11 - DCAP404 _Object Oriented Programming
P. 11

Object-oriented Programming




                    Notes          3.  Data Abstraction: Abstraction refers to the act of representing essential-features without
                                       including the background details or explanations. Abstraction is indispensable part of the
                                       design process and is essential for problem partitioning. Partitioning  essentially is the
                                       exercise in determining the components of the system. However, these components are
                                       not isolated from each other, they interact with each other. Since the classes use the concept
                                       of data abstraction, they are known as Abstract Data Types (ADT).


                                          Example: We can represents essential features without including background details
                                   and explanations.

                                     index  of  text  book.
                                       class  School
                                        {
                                               void  sixthc  lass();
                                               void  seventhclass();
                                                 void  tenthclass();

                                         }
                                   4.  Data Encapsulation: The wrapping up to data and functions into a single unit (class) is
                                       known as encapsulation. Data encapsulation is the most striking feature of a class. The
                                       data is not accessible to the outside world and only those functions that are wrapped in the
                                       class can access it. These functions provide the interface between the object’s data and the
                                       program. This insulation of the data from direct access by the program is called data
                                       hiding.
                                   5.  Inheritance: Inheritance is the process by which objects of one class acquire the properties
                                       of objects of another class. It supports the concept of hierarchical classification. For example,
                                       an manager class is a type of the class employee, which again is a type of the class person
                                       as illustrated below.
                                       The principle behind  this sort of division  is that  each derived  class shares  common
                                       characteristics with the class from which it is derived. The power of inheritance lies in the
                                       fact that all common features of the subclasses can be accumulated in the super class. In
                                       other words, a feature is placed in the higher level of abstraction. Once this is done, such
                                       features can be inherited from the  parent class and used in the  subclass directly. This
                                       implies that if there are many abstract class definitions available, when a new class  is
                                       needed, it is possible that the new class is a specialization of one or more of the existing
                                       classes.
                                       In OOP, the concept of inheritance provides the idea of reusability. This means that we can
                                       add additional features  to an existing class  without modifying  it. This  is possible  by
                                       deriving a new class from the existing one. The new class will have the combined features
                                       of both the classes.   Each subclass defines only those features that are unique to it. In OOP,
                                       The concept of inheritance provides the idea of reusability. This means that we can add
                                       additional features to an existing class without modifying it. This is possible by deriving
                                       a new class from the existing one. The new class will have the combined features of both
                                       the classes.


                                       !
                                     Caution  Keep in mind that each subclass defines only those features that are unique to it.





          4                                 LOVELY PROFESSIONAL UNIVERSITY
   6   7   8   9   10   11   12   13   14   15   16