Skip to content

Tag Archives: C++-Operator Overloading

In C++, we can make operators to work for user-defined classes. This means C++ has the ability to provide the operators with a special meaning… Read More
In this article, we will discuss the Overloading of the function-call operators in C++. The function call operator is denoted by “()” which is used… Read More
In this article, we will discuss the unformatted Input/Output operations In C++. Using objects cin and cout for the input and the output of data… Read More
Prerequisite: Operator Overloading in C++, Types of Operator Overloading When an object calls an operator function by passing an argument and the returned value of… Read More
Given N triangles along with the length of their three sides as a, b and c. The task is to count the number of unique… Read More
The dot (.) operator is used for direct member selection via object name. In other words, it is used to access the child object. Syntax:… Read More
Pre-requisite: Operator Overloading in C++Given two strings. The task is to concatenate the two strings using Operator Overloading in C++. Example:  Input: str1 = "hello",… Read More
Given Q queries of type 1, 2, 3 and 4 as described below.   Type-1: Insert a number to the list. Type-2: Delete only one occurrence… Read More
Which of the following operator functions cannot be global, i.e., must be a member function. (A) new (B) delete (C) Conversion Operator (D) All of… Read More
#include<iostream> using namespace std;    class Point { private:   int x, y; public:   Point() : x(0), y(0) { }   Point& operator()(int dx, int dy);   void… Read More
Predict the output? #include<stdlib.h> #include<stdio.h> #include<iostream>    using namespace std;    class Test {     int x; public:     void* operator new(size_t size);     void operator delete(void*);     Test(int… Read More
Output of following program? #include <iostream> using namespace std; class Test2 {     int y; };    class Test {     int x;     Test2 t2; public:     operator… Read More
Predict the output #include<iostream> using namespace std; class A {     int i; public:     A(int ii = 0) : i(ii) {}     void show() {  cout <<… Read More
How does C++ compiler differs between overloaded postfix and prefix operators? (A) C++ doesn’t allow both operators to be overloaded in a class (B) A… Read More
Which of the following operators should be preferred to overload as a global function rather than a member method? (A) Postfix ++ (B) Comparison Operator… Read More

Start Your Coding Journey Now!