Category Archives: C++

Write a Program to Addition, subtraction and multiplication of two numbers using function

In this programming tutorial, you will learn how to write a program in three different programming languages to do Addition, subtraction, and multiplication of two numbers using function. Functions are supported in every programming language, and they make it to write reusable code and make the complete program more modular. Addition, subtraction, and multiplication of two numbers using… Read More »

Error: Id returned 1 exit status (undefined reference to ‘main’)

“Error: Id returned 1 exit status (undefined reference to ‘main’)” is a very common C and C++ linker Error. Just by looking at the statement, we can tell that there is an error in the main function. main() function Every C++ and C program contain a mandatory inbuilt function called main(). The compiler starts the execution from the main… Read More »

10 Top C++ Libraries for Developers to Use in 2021

Creating a full-fledged interactive application or program using a high-level programming language could be daunting if you write the code from scratch. Using a library, however, could make this task easier. Every high-level programming language allows a developer to leverage the code of another developer. This feature helps a programming language community to grow when more and more… Read More »

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 but have different… 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 operators. Types of… 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 after function call… 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> #include<cstring> using namespace… 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 << stream insertion… 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 want you can… 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 {   private… Read More »