Wednesday, June 10, 2015

Object-Oriented Programming Concepts

OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self sustainable "objects". Hence, you gain re-usability by means of four main object-oriented programming concepts.Below are object oriented programming concepts :

  1. Object

    Object is representative of the class and is responsible for memory allocation of its data members and member functions.An object is a real world entity having attributes (data type) and behaviors (functions).
    An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object behavior. For example, the hand can grip something or a Student (object) can give the name or address
  2. Class

    Class is a data structure that contains data members (constants files, events), member function methods, properties, constructor, destructor, indexers and nested type.Basically
    1. It is a user defined data type.
    2. It is a reference type.
    3. Infact class is a tag or template for object.
  3. Encapsulation

    Encapsulation is a mechanism of binding the data member & member function into a single unit known as class.Encapsulation provides a way for abstraction.In OOP the encapsulation is mainly achieved by creating classes, the classes expose public methods and properties. The class is kind of a container or capsule or a cell, which encapsulate the set of methods, attribute and properties to provide its indented functionalities to other classes.
  4. Data abstraction

    Data abstraction is a mechanism to provide the essential features without describing the background details. Means provide the functions to access the hidden (private) data.
    The importance of abstraction is derived from its ability to hide irrelevant details and from the use of names to reference objects. Abstraction is essential in the construction of programs. It places the emphasis on what an object is or does rather than how it is represented or how it works. Thus, it is the primary means of managing complexity in large programs.
  5. Data Hiding

    Data hiding is a mechanism to hide the internal structure of an object from rest of the program.In a class private members are hidden from the rest of the program, hence it supports data hiding. Data hiding is also a way to implement data abstraction.
  6. Polymorphism

    Polymorphism means one thing in many form.Basically polymorphism is capability of one object to behave in multiple ways. Example : A man role changes at home, college, and outside the home. There are following types of polymorphism :
    1. Static polymorphism(compile time) :It is achieved using function overloading and operator overloading.
    2. Dynamic polymorphism(runtime time) : It is achieved using function overriding means using virtual function.

No comments:

Post a Comment