Basic Concepts of Object Oriented Programming

By
Advertisement
The object orientation feature is derived from the five Basic Concepts of Object Oriented Programming and it is therefore necessary to understand the some of the concepts used extensively in object oriented programming.

Object and Classes


                    Objects are basic run time entities in an object oriented system. They many represent a person, a place, a bank account, a tables of data or any item that program may handle. They may also represent user defined data types such as Vectors and Lists. Any programming problem is analyzed in terms  of objects and the nature of communication between them.

               An object takes up space in the memory and has an associated address like a structure in C. When a program is executed, the objects interact by sending messages to one another.


A class may be thought of as a user defined data type and object as variable of that data types. Once a class has been defined, we can create any number of objects belonging to that class. Each object is associated with the data of type class with which they are created.

             A class is thus a collection of objects of similar type. For example, Mango, Apple, and Orange are members of the class fruit.

Data Abstraction and Encapsulation


  The wrapping of   data and methods into a single unit ( called class ) is known as encapsulation.
  The Data encapsulation is the most stricking feature of a class. The data is not accessible to the outside world and only those methods, which are wrapped in the class can access it.
These methods provides the interface between the objects data and the program. This insulation of the data from direct access by the program is called data hiding.

Abstraction refers to the act of representing essential features without including the background details or explanations.

      classes use the concept of abstraction and  are defined as a list of abstract attributes such as size, weight and cost, and methods  that operate on these attributes.They encapsulates all the essential properties of the objects that are to be created.


Inheritance



                  Inheritance is the process by which object of one class acquire the properties of objects of another class.

 In, OOP, the concept of inheritance provides the idea of re-usability. 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. 
          

 Polymorphism 


                Polymorphism  is another important OOP concept. Polymorphism  means the ability to take more than one form. For example, an operation may exhibit different behavior in different instances. The behavior depends upon the type of the type of data used in the operation.


              Polymorphism  is extensively used in implementing inheritance. It can be achieved in two ways. 1. Overriding 2.  Overloading.

Data Binding 


           Generally binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic Binding means that the code associated with a given procedure call is not know until the time of the call at run time.

                                   It is associated with polymorphism and  inheritance. A procedural call associated with a polymorphism reference depends on the dynamic type of that reference.


Message communication



             Messages are passed between object to objects and object to methods of class in different ways depending on the calls made in a program. 


                        Object communication with one another by sending and receiving information much the same way as people pass messages to one another. 

0 comments:

Post a Comment