Linked Questions

9 votes
1 answer
10k views

What is the difference between inside and outside class overloading? class A{ public: bool operator==(const A *i){ .... .... } }; vs bool operator==(const A *i ,...
Michael Oks's user avatar
4 votes
3 answers
4k views

i have a class which needs to implement the operator== and return type of it is bool. I'm not sure is below code the correct way to implement it. //MyTest.hpp file class Test { public: Test(); ...
user1291401's user avatar
2 votes
3 answers
2k views

I'm new to C++ and I'm starting with learncpp website. In Assignment Operator Overloading chapter has those lines of code: Fraction& Fraction::operator= (const Fraction &fraction) { ...
sasorihuriko's user avatar
1 vote
6 answers
1k views

I always thought of cout and cin calls as something like this: cout << someVar tells the compiler we're dumping the value of someVar into cout, just as we could dump water into a physical ...
user avatar
1 vote
4 answers
637 views

I'm trying to overload the assignment operator and would like to clear a few things up if that's ok. I have a non member function, bool operator==( const MyClass& obj1, const myClass& obj2 ) ...
user40120's user avatar
  • 658
1 vote
3 answers
5k views

I am confused about strict weak ordering and how to use it when defining operator<. I have a couple of structs: struct Plane { std::string name; int xrudder; int yrudder; int ...
user974967's user avatar
  • 2,946
0 votes
8 answers
473 views

What is the main purpose of overloading operators in C++? In the code below, << and >> are overloaded; what is the advantage to doing so? #include <iostream> #include <string>...
Geo Drawkcab's user avatar
4 votes
4 answers
1k views

#include <iostream> using namespace std; class family { private: double weight; double height; public: family(double x,double y); ~family(); double ...
appleJuice's user avatar
7 votes
1 answer
436 views

Possible Duplicate: Operator overloading I am seeing this in a piece of sample code: operator Vector2<float>() const { return Vector2<float>(x, y); } My 2 questions ...
johnbakers's user avatar
  • 24.9k
2 votes
6 answers
406 views

Could anybody explain me what is the difference between overload == and <? For example, if I use a map: map<Type, int> a(); friend bool operator<(const Type& lhs, const Type& ...
thiagoh's user avatar
  • 7,458
3 votes
2 answers
243 views

Okay, not sure what I'm doing here, other than it's not right. Trying to overload the '==' method of a class, and it's just... not working. At least, I get a false back from my main, and the cout in ...
Stephen's user avatar
  • 6,097
2 votes
1 answer
3k views

I was reading a paper on automatic differentiation and the authors mention: "Likewise, using operator overloading may introduce method dispatches with attendant costs, which, compared to raw numerical ...
John's user avatar
  • 3,115
0 votes
1 answer
5k views

So i've been told that in order for part of my program to work that I need to overload the == operator, unfortunately I have absolutely no idea how to do this, here is the class for which the operator ...
Hunter Tipton's user avatar
4 votes
1 answer
2k views

So far every operator works fine except for this one. When I run the code, I get the error: "error: postfix 'Complex Complex::operator++(Complex)' must take 'int' as its argument|" Heres my code: #...
Luke D's user avatar
  • 59
1 vote
7 answers
1k views

Possible Duplicate: Operator overloading Hi guys can some one please suggest a good tutorial on operator overloading? I was going through this code on operator overloading and I have the following ...
Frustrated Coder's user avatar

15 30 50 per page
1 2 3
4
5
93