Freshers Aptitude technical questions
Freshers Job Alert
Bookmark and Share

Object Oriented Programming

This Object Oriented programming(oop) tutorial will help you to learn more.Please update yourselves.


  • Object-Oriented Programming groups related data and functions together in a class , generally making data private and only some functions public. Restricting access decreases coupling and increases cohesion. While it is not a panacea, it has proven to be very effective in reducing the complexity increase with large programs. For small programs may be difficult to see the advantage of OOP over, eg, structured programming because there is little complexity regardless of how it's written. Many of the mechanics of OPP are easy to demonstrate; it is somewhat harder to create small, convincing examples.

    OOP is often said to incorporate three techniques: inheritance, encapsulation, and polymorphism. Of these, you should first devote yourself to choosing the right classes (possibly difficult) and getting the encapsulation right (fairly easy). Inheritance and polymorphism are not even present in many programs, so you can ignore them at that start.


    Encapsulation is grouping data and functions together and keeping their implementation details private. Greatly restricting access to functions and data reduces coupling , which increases the ability to create large programs.

    Classes also encourage coherence , which means that a given class does one thing. By increasing coherence, a program becomes easier to understand, more simply organized, and this better organization is reflected in a further reduction in coupling.


    Inheritance means that a new class can be defined in terms of an existing class. There are three common terminologies for the new class: the derived class, the child class, or the subclass . The original class is the base class, the parent class, or the superclass . The new child class inherits all capabilities of the parent class and adds its own fields and methods. Altho inheritance is very important, especially in many libraries, is often not used in an application.


    Polymorphism is the ability of different functions to be invoked with the same name. There are two forms.

    Static polymorphism is the common case of overriding a function by providing additional definitions with different numbers or types of parameters. The compiler matches the parameter list to the appropriate function.

    Dynamic polymorphism is much different and relies on parent classes to define virtual functions which child classes may redefine. When this virtual member function is called for an object of the parent class, the execution dynamically chooses the appropriate function to call - the parent function if the object really is the parent type, or the child function if the object really is the child type. This explanation is too brief to be usesful without an example, but that will have to be written latter.