Basic concepts (features) of C++

Basic concepts (features) of Object-Oriented Programming C++

Basic concepts (features) of Object-Oriented Programming C++

In this tutorial, We will Learn:

Basic concepts and features of object oriented programming language like C++.

Following are the features or basic concepts of C++ programming language.

1. Objects and Classes

2. Data abstraction

3. Data encapsulation

4. Inheritance

5. Polymorphism

6. Binding

7. Message passing

1. Objects and Classes:

Classes are user-defined data types on which objects are created. Objects with similar properties and methods are grouped together to form a class. So class is a collection of objects. The object is an instance of a class.

2. Data abstraction

Abstraction refers to the act of representing essential features without including the background details or explanation.

Example: Let’s take one real life example of a TV, which you can turn on and off, change the channel, adjust the volume, and add external components such as speakers, VCRs, and DVD players, BUT you do not know its internal details, that is, you do not know how it receives signals over the air or through a cable, how it translates them, and finally displays them on the screen.

See also  Inline function and find the maximum of two numbers in C++

Example Data abstraction:

#include <iostream>

Using namespace std;

int main( )

{

cout << “Hello C++” <<endl;

return 0;

}

Here, you don’t need to understand how cout displays the text on the user’s screen. You need to only know the public interface and the underlying implementation of cout is free to change.

3. Data encapsulation

Information hiding, Wrapping (combining) of data and functions into a single unit (class) is known as data encapsulation.

Data is not accessible to the outside world, only those functions which are wrapped in the class can access it.

4. Inheritance

Inheritance is the process of deriving a new class from an existing class. Existing class is known as base, parent or super class. The new class that is formed is called derived class, child or sub class. Derived class has all the features of the base class plus it has some extra features also.

Writing reusable code. Objects can inherit characteristics from other objects.

See also  Difference between POP and OOP

5. Polymorphism

The dictionary meaning of polymorphism is “having multiple forms” or Ability to take more than one form.

A single name can have multiple meanings depending on its context. It includes function overloading, operator overloading.

6. Binding

Binding means connecting the function call to the function code to be executed in response to the call.

Static binding means that the code associated with the function call is linked at compile time. Also known as early binding or compile time polymorphism.

Dynamic binding means that the code associated with the function call is linked at runtime. Also known as late binding or runtime polymorphism.

7. Message passing

Objects communicate with one another by sending and receiving information.

Summary:

In this article, we understood the basic features or concepts of C++ programming language.

If you like the tutorial share it with your friends. Like the Facebook page for regular updates and YouTube channel for video tutorials.

See also  C++ Video Tutorial

Leave a Comment

Your email address will not be published. Required fields are marked *