C++ - Programming Language

C++ – Programming Language

C++ is a general-purpose programming language. It is very popular among engineers who have written JEE Main exam. It was developed by Bjarne Stroustrup in 1979 at the AT&T Bell Labs where Stroustrup was the head of Large-scale Programming Research department till 2002. Originally this programming language was worked on as addition to C language and was called C with Classes. Later in 1983, it was renamed as C++ by Rick Mascitti. This mid-level programming language runs on various platforms like Windows MacOS and various versions of UNIX. This programming language is considered as mid-level programming as it has aspects of low-level and high-level programming language features. This programming language is taught to engineers who can write code for entrance exams like NEET 2019 website.

Here are some of salient features of C++ listed below:

  • It is a simple syntax based programming language
  • It is an object-oriented programming language
  • It is case-sensitive programming language
  • It is platform dependent programming language
  • It is compiler-based programming language
  • It has a hugely functional library
  • It is powerful fast and efficient
  • It is also portable as it can be compiled on various platforms

C++ Classes Concept

C++ Classes are the blueprint for data type. A class defines what an object will consist of and operations that can be performed on the object. It usually starts with the keyword class with class name and body, in a pair of curly brackets. Classes can be classified into public, private and protected. C++ Object works on the blueprint created by class. Basically, object is created from class. There are various sub-sections of classes and objects. They are listed here:

C++ sub-section of classes

  • Class Member Functions
  • Class Access Modifiers
  • Constructor & Destructor
  • Copy Constructor
  • Friend Functions
  • Inline Functions
  • This Pointer
  • Pointer to C++ classes
  • Static members of a Class

Polymorphism

Polymorphism means an object possessing the ability to have many forms. Usually, this occurs when there is a hierarchy of various classes and they’re related by inheritance. C++ polymorphism means a call to perform a different function depending on the object that calls for function. This is how it usually works with a function with the same name parameters but with different implementations.

Polymorphism in C++ can be divided into two types:

  • Compile Time Polymorphism
  • Runtime Polymorphism

Compile Time Polymorphism in C++

Compile Time Polymorphism is usually occurred by function overloading or operator overloading. Function overloading is when a function with the same name and different parameters. A function is considered overloaded when there is a change in number of arguments or/and change in type of arguments. Operator overloading is when an operator is assigned to a complicated task for example when an addition symbol which adds numbers is written in a way that it is required to add complex numbers.

Runtime Polymorphism in C++

Runtime Polymorphism is occurred by function overriding. Function Overriding occurs when a derived class has a definition for one of the member functions of base class. Then the base function is considered to be overridden.

Conclusion

This polymorphism is an advantage to the programming language. But if the coder wants to cancel out polymorphism then the Encapsulation in C++ is used. Encapsulation in C++ protects the data and functions from outside interference and misuse. Encapsulation is also an advantage of C++.

Subscribe to this blog to get latest post direct into your inbox.

Share the Article

About author
Darshan Saroya

Darshan Saroya

A passionate WordPress Theme Developer. I love to create clean and modern themes, using the power of WordPress. Here I provide the tutorials related to WordPress Development, Core PHP and HTML.

2 Comments

gulshan

gulshan

January 2, 2020 at 12:19 pm Reply

This content is really informative, thanks for sharing.

NEET

NEET

March 16, 2020 at 2:31 pm Reply

Thank you very much for sharing the informative blog. This is really fantastic. If this is possible, please update on an ongoing basis.