Page 9 - DCAP404 _Object Oriented Programming
P. 9

Object-oriented Programming




                    Notes          1.1 Basic Concept of Object-oriented Programming

                                   Procedural programming deals with functional parts  of the problem. Programmers  identify
                                   what actions must be taken to solve the problem at hand. Let us now, try to understand what
                                   aspect  of problems  is dealt  with in  object-oriented approach.  We shall  be discussing some
                                   essential concepts that make a programming approach object-oriented.
                                   In object-oriented parlance, a problem is viewed in terms of the following concepts:
                                   1.  Objects
                                   2.  Classes
                                   3.  Data abstraction

                                   4.  Data encapsulation
                                   5.  Inheritance
                                   6.  Polymorphism

                                   7.  Dynamic  binding
                                   8.  Message passing
                                   Let us now study the entire concept in detail.
                                   1.  Objects: Objects are the basic run-time entities in an object-oriented system. They may
                                       represent a person, a place, a bank account, a table of data; they may also represent user-
                                       defined data such as vectors, time and lists.

                                       They occupy space in memory that keeps  its state  and is  operated on  by the defined
                                       operations on the object. Each object contains data and code to manipulate the data.





                                     Notes  Objects can interact without having to know details of each other data or code.
                                       The figure 1.1 shows the two notations popularly used.

                                                                     Figure  1.1


                                            Object: STUDENT
                                                                                               STUDENTS
                                                DATA
                                                                                  Total
                                                Name
                                              Date-of-birth
                                                Marks
                                                ..............
                                                ..............
                                                                                  Avg
                                              FUNCTIONS
                                                 Total
                                                 Avg.
                                                Display
                                                                                 Display
                                                  (a)

                                                                                                (b)





          2                                 LOVELY PROFESSIONAL UNIVERSITY
   4   5   6   7   8   9   10   11   12   13   14