C++ & Object Oriented Programming

“C++: where friends have access to your private members.”

— Gavin Russell Baker.

C++ is an object oriented computer language created by extraordinary computer scientist Bjorne Stroustrop as part of the evolution of the C family of languages. It is a general purpose programming language and is widely used these days for competitive programming. It has imperious, object-oriented and inclusive programming attributes. It operates on lots of platform like Windows, Linux, UNIX, Mac, Free BSD, POSIX-compliant OSes etc. It is a middle-level language making it the advantage of programming low-level (i.e. drivers, kernels) and even higher-level applications (i.e. games, GUI, desktop apps etc.). The basic syntax and code structure of C++ resembles with C.

 Features of the language:

  • It is a simple language in the sense that its programs can be broken down into logical units; it also has a rich library support and a variety of data-types.
  • A C++ workable program is not platform-independent (compiled programs on Linux won’t run on Windows), however they are machine independent.
  • It is a middle-level language as we can do both system-programming (drivers, kernels, networking etc.) and can build large-scale user applications (Media Players, Photoshop, Game Engines etc.)
  • C++ programs excel in execution speed. New languages have extra in-built default features such as garbage-collection, dynamic typing etc. which slow the execution of the whole program. Since there is no additional processing overhead like this in C++, it is blazing fast.
  • C++ provides pointer support which assists users to directly manipulate storage address. This helps in doing low-level programming; where one might need to have explicit control on the storage of variables.
  • Object-Oriented support is one the most special features that distinguishes C++ from other languages. It helps C++ to make maintainable and extensible programs, i.e. large-scale applications can be built.

Applications of the language:

  • Operating Systems & Systems Programming. e.g. Linux-based OS i.e. Ubuntu.
  • Browsers (Chrome & Firefox)
  • Graphics & Game engines (Photoshop, Blender, Unreal-Engine)
  • Database Engines (MySQL, MongoDB, Redis etc.)
  • Cloud/Distributed Systems

Why one should choose C++?

  • C++ is one of the world’s most popular programming languages.
  • C++ can be found in today’s operating systems, Graphical User Interfaces, and embedded systems.
  • C++ is an OOP language which gives a clear structure to programs and allows the reusability of the code and lowers the development costs.
  • C++ is portable and can be used to develop applications which are feasible or can be adapted by other platforms.

OOP Languages

  1. The basic unit of OOP is a class, which encapsulates both the static attributes and dynamic behaviors within a “box”, and specifies the public interface for using these boxes. Since the class is well-encapsulated, it is easier to reuse these classes.
  2. OOP languages permit higher level of abstraction for solving real-life problems. The traditional procedural languages force you to think in terms of the structure of the computer rather than thinking in terms of the problem one is trying to solve.

Object-Oriented Programming in C++

Object-oriented programming revolves around data. The main programming unit of OOP is the object. An object is the representation of a real-time entity and consists of data and methods or functions that operate on data. In this way, data, and functions are closely bound and data security is ensured. In OOP, everything is represented as an object and when programs are executed, the objects interact with each other by passing messages/information. It is not necessary for an object to know each and every detail for the communication. Object oriented programming is a way of solving complex problems by breaking them into smaller units using objects. Prior to Object Oriented Programming, the programs were written in the procedural language, they were a long list of instructions. On the other hand, the OOP is all about creating objects that can interact among themselves; this makes it easier to develop programs in OOP.

OOP Features

  • Classes and objects
  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message Passing

Advantages of OOP

  • Reusability
  • Modularity
  • Flexibility
  • Maintainability
  • Data and information hiding

Leave a comment

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started