Operator+ etc is not working please help! 
Author Message
 Operator+ etc is not working please help!

I am using some standard library compatible code C++ for a project in
MFC. However when trying to use a function like
MyClass operator+(MyClass Obj1, MyClass Obj2);
I only accepts one argument, however this should be a leagal way of
using the operator+ and it works elsewhere. How do I make it work with
MFC. Since I have to have it fully compatible with other projects I
have to be able to put it with 2 arguments as above.
What do I do?????????
/Gustaf

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 26 Jun 2002 03:00:00 GMT  
 Operator+ etc is not working please help!
MFC cannot be a reason here.
If you have your operator+ as a member of MyClass it cannot accept two
arguments. Only one. The other one (and it is first) is (*this). If you
need your operator+ to have two arguments you must not declare it as a
class member. In this case you'll probably need to declare it as friend
for class MyClass.


Quote:

> I am using some standard library compatible code C++ for a project in
> MFC. However when trying to use a function like
> MyClass operator+(MyClass Obj1, MyClass Obj2);
> I only accepts one argument, however this should be a leagal way of
> using the operator+ and it works elsewhere. How do I make it work with
> MFC. Since I have to have it fully compatible with other projects I
> have to be able to put it with 2 arguments as above.
> What do I do?????????
> /Gustaf

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 26 Jun 2002 03:00:00 GMT  
 Operator+ etc is not working please help!
See my reply to this in comp.lang.c++

NeilB

Quote:

> I am using some standard library compatible code C++ for a project in
> MFC. However when trying to use a function like
> MyClass operator+(MyClass Obj1, MyClass Obj2);
> I only accepts one argument, however this should be a leagal way of
> using the operator+ and it works elsewhere. How do I make it work with
> MFC. Since I have to have it fully compatible with other projects I
> have to be able to put it with 2 arguments as above.
> What do I do?????????
> /Gustaf

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 26 Jun 2002 03:00:00 GMT  
 Operator+ etc is not working please help!
Make it a non-member function.

Donald Xie

I am using some standard library compatible code C++ for a project in
MFC. However when trying to use a function like
MyClass operator+(MyClass Obj1, MyClass Obj2);
I only accepts one argument, however this should be a leagal way of
using the operator+ and it works elsewhere. How do I make it work with
MFC. Since I have to have it fully compatible with other projects I
have to be able to put it with 2 arguments as above.
What do I do?????????



Wed, 26 Jun 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Can't use operator+ etc when working in MFC

2. Not operator NOT working (!)

3. I am not able to see my database class members in class view - Please help

4. IMPORTANT: IntelliSense does not work after __typeof operator

5. update overloading [][] ..working but not with a template operator ..arrrrrrrrrgghghhh

6. IMPORTANT: IntelliSense does not work after the __typeof operator

7. Overriding operator== Does Not Work in find Algorithm

8. Please help: why is this program not working?

9. The Tab Key Do Not Works In MFC Generated Active-X Control Please Help

10. Recordset Code works in View Class in OnRButtonDown but not in OnInitialUpdate or OnDraw - Please Help

11. CBitmapButton does not work, please help.

12. CryptImportKey not working in Pocket PC 2002-Urgent Please help

 

 
Powered by phpBB® Forum Software