Category Archives: C++

C++ Polymorphism

Polymorphism is one of the most important properties of Object-Oriented Programming, the word polymorphism is made by the combination of two Greek words Poly + morph, poly means “many” and morph means forms and its name resemblance its definition. Polymorphism concept state that there could be more than one function that shares the same name… Read More »

C++ Overloading

In C++, within scope, we can have more than one definition for a Function and operator, which mean using the same function and operator we can perform different tasks, though functions and operators are designed to perform a specific task, but using the concept of overloading we can switch between the definitions of functions and… Read More »

Function Call Operator() Overloading in C++

Using the concept of Operator Overloading we can overload the function call operator (), and when we say we can overload the function call operator () we do not mean we can redefine a new way to call a function, rather in function call operator overloading we redefine the parameters accepted by the function and… Read More »

Assignment Operators Overloading in C++

The assignment operator (=) in C++ is used to assign the values to the variables and like other operators using the Operator Overloading we can overload or redefine the task of assignment operator for Class-based user-defined objects. Syntax to Overload Assignment Operator return_type operator = (Class_name object_name) { // Redefining Body: } Example #include <iostream>… Read More »

Input/Output Operators Overloading in C++

In C++ we use the stream extraction operators with stream statements (cin, cout) to show outputs and take input from the user. And using the C++ Operator Overloading techniques we can overload or redefine the stream extraction operators for user-defined class-based Objects. Like other Operator we cannot directly overload the >> stream extraction operator and… Read More »

Relational Operators Overloading in C++

Relational Operators are used to comparing two data objects and using the class Operator Overloading Methods we can overload the relational Operators for class-based objects. There are various Relational operators in C++ such as <, >, <=, >=, ==, etc. which are Overloadable. Here we have overloaded two Relational Operators < and > if you… Read More »

Binary Operators Overloading in C++

Binary operators require two operands to perform the task and using the Operator overloading we can redefine the task of a Binary operator for user-defined class objects. The syntax for Binary Operator Overloading function return_type operator operator_symbol (Class_Name object_name) { // redefining the operator task } Example #include <iostream> #include<string.h> using namespace std; class Displacement… Read More »

Unary Operators Overloading in C++

Unary operators are those special symbols that can operate on a unary or single operand, for instance, ++(increment), –(decrement) and ! (not) operators. As we have already discussed in the Operator overloading rules that we can only redefine the operator task for the user-defined class-based object so here the example itself using a class and… Read More »

C++ Inheritance

Inheritance is one of the important properties of Object-Oriented Programming, Inheritance allows us to inherit the properties of one class to another. Inheritance increases the concept of code-reusability, which means we need to write code once and we can use it again and again in different places of the program. Inheritance concepts When we implement… Read More »

C++ Classes & Objects

C++ is an extension of the C programming language, and the Object-Oriented Programming (OOPs) concept made C to C++. There are many properties of Object Orientation Programming and class & objects are the core fundamentals we use to implement the OOP’s concepts.   Class in C++ A class is a Data Structure and a building… Read More »