C++ Tutorials
" C++ is a widely used language even Adobe Photoshop is developed in C++ programming language. "

C++ and Object Oriented Programming

Object Oriented programming is a programming style that is associated with the concept of OBJECTS, having datafields and related member functions.

Objects are instances of classes and are used to interact amongst each other to create applications. Instance means, the object of class on which we are currently working. C++ can be said to be as C language with classes. In C++ everything revolves around object of class, which have their methods & data members.

C++ can be said to be as C language with classes. In C++ everything revolves around object of class, which have their methods & data members.

basic oops concept in c++

For Example : We consider human body as a class, we do have multiple objects of this class, with variable as color, hair etc. and methods as walking, speaking etc.

Now, let us discuss some of the main features of object oriented programming which you will be using in C++.

  1. Objects
  2. Classes
  3. Abstraction
  4. Encapsulation
  5. Inheritance
  6. Overloading
  7. Exception Handling

Objects

Objects are the basic unit of OOP. They are instances of class, which have data members and uses various member functions to perform tasks.


Class

It is similar to structures in C language. Class can also be defined as user defined data type but it also contains functions in it. So, class is basically a blueprint for object. It declare & defines what data variables the object will have and what operations can be performed on the class's object.


Abstraction

Abstraction refers to showing only the essential features of the application and hiding the details. In C++, classes provide methods to the outside world to access & use the data variables, but the variables are hidden from direct access.


Encapsulation

It can also be said data binding. Encapsulation is all about binding the data variables and functions together in class.


Inheritance

Inheritance is a way to reuse once written code again and again. The class which is inherited is called base calls & the class which inherits is called derived class. So when, a derived class inherits a base class, the derived class can use all the functions which are defined in base class, hence making code reusable.


Polymorphism

Polymorphion makes the code more readable. It is a features, which lets is create functions with same name but different arguments, which will perform differently. That is function with same name, functioning in different


Overloading

Overloading is a part of polymorphion. Where a function or operator is made & defined many times, to perform different functions they are said to be overloaded.


Exception Handling

Exception handling is a feature of OOP, to handle unresolved exceptions or errors produced at runtime.