Linked Questions

2493 votes
10 answers
1.1m views

Note: The answers were given in a specific order, and have received varying amounts of votes over time. Since the order of answers depends on your answer sorting preferences, here's an index of the ...
sbi's user avatar
  • 225k
8 votes
3 answers
6k views

I have these code of lines from a program my teacher made : TimeKeeper& operator++() { d_seconds++; return *this; } const TimeKeeper operator++(int) { TimeKeeper tk(*...
user2843560's user avatar
1 vote
2 answers
818 views

As we know to differentiate between pre-increment & post-increment operator function, we use a dummy argument in post-increment operator function. But how the compiler INTERNALLY differentiate ...
user14401314's user avatar
-1 votes
2 answers
317 views

I'm having trouble with the unary ++ overloaded operator. Here is my code... #include<iostream> using namespace std; class Index{ int value; public: Index() : value(0) { } ...
user5422891's user avatar
0 votes
1 answer
93 views

#include <iostream> enum class Color { RED, GREEN }; Color& operator++(Color& source) { switch (source) { case Color::RED: return source = Color::GREEN; case ...
arda30's user avatar
  • 83
-2 votes
1 answer
83 views

** Pre Increment ** #include <iostream> using namespace std; class demo { int i; public: demo (int b = 0) { i = b; } void display() { cout<<"Number ...
Vijay Gunwant's user avatar
0 votes
1 answer
60 views

I have this piece of C++ code to overload the pre-increment and post-increment operators. The only difference between those methods is the number of their arguments. I want to know how C++ understands ...
Mohammad's user avatar
  • 145
2 votes
6 answers
5k views

am beginner to c++ and i want to know how operator ++ moves iterator backward. As i know iterator.begin() and iterator.end() returns pointer to fist index and last index respectively. vector<int&...
Swapnil's user avatar
  • 401
4 votes
2 answers
440 views

I am studying Lafore's 4th editing of C++ book and I am stuck with this problem. I have these two classes, CountDn derives from Counter. In CountDn I want to overload the prefix for decrement operator ...
Stef's user avatar
  • 41
0 votes
1 answer
448 views

I Have some doubt in operator overloading in c++. #include<iostream> using namespace std; class ex { int i; public: ex(){} void operator+(ex ob); void seti(int x); int geti(...
user avatar
1 vote
1 answer
120 views

When writing f(x++), we mean f(x);++x; Yet the operator for an object is usually written as foo operator++(int) { foo temp = *this; ++*this; return temp; } Can I make it works like const ...
l4m2's user avatar
  • 1,177
1 vote
0 answers
48 views

I'm using Visual Studio 2015 Update 3 and encountered the following warning while writing a simple class which basically is just a wrapper around an int. The example below is not the actual class but ...
Rafael Pasquay's user avatar