Understanding Object Oriented Programming

There are three main parts of the object oriented programming which includes abstraction, inheritance and encapsulation. In the object oriented programming languages, programs are designed with the concept of objects. In this, each object contains its own set of variables to store the data relevant to the object. It also stores functions to perform action, perform calculations, add data to variables inside the object, etc.

Objects represent various things in a program, like a Square which is called as Abstraction. An object for a square in a math program would have a set of variables, length and width, that can only be accessed by functions inside the object and this is called as encapsulation. This reduces the chance of breakage while programming. The next part of an object function, represent things that the object can do or ways to interact with it. For example, in case of a square object, a function called area, will calculate the area of the square that the object represents, using the contents of the length and width variables inside the object.

Inheritance is used to calculate area of not only squares, but also other shapes, such as, a circle in the math. Inheritance is referred as creation of an object based on another object. Therefore, it inherits all of its variables and functions. Concept of inheritance is used to deal with large programs, where objects typically contain lots of lines of code, in which rewriting an object similar to another would be tedious and pointless.

In Object Oriented Programming, Java and C++ are the commonly used languages. Both are good languages for various things.