C++ Object Oriented Programming

In C++ OOP stands for Object Oriented Programming. As the name suggests, in Object Oriented Programming, a programmer works with objects. Objects are main entities of OOP that contain both data and functions. Contrary to the procedural programming, classes and objects provide an interactive way of programming for user. Procedural programming confines the user to use multiple functions having no relation between them. OOP covers the following concepts.

OOP Concepts

With OOP, programmer can create relation between objects. Each entity can be treated as an object. Object can further have a set of properties and functions. For example, vehicle is an entity. It can be defined as an OOP object. Vehicle can have various properties like model, color, build etc. Similarly the operations that a vehicle can perform like drive, steer left right, stop are the functions of the vehicle object. Now using the main vehicle object, programmer can define different types of vehicles like car, truck, bike using the same class. These vehicles can then have various properties and functions depending on the type of vehicle.

Advantages of OOP

The major advantage of OOP is that is provides code reusability without code repetition. It strictly follows the coding principle DRY (Don’t Repeat Yourself). Object oriented programming is an efficient way of coding that gives faster execution. In code with classes and objects user has a clear understanding of the program because of its composed structure. OOP allows the programmer to solve large and intricate problems easily by breaking them down in smaller functions. With OOPs, programmer can hide the main code from user and still give the ability to use objects and its functions.