HELP: Overloading Assignment Operators in MC++ 
Author Message
 HELP: Overloading Assignment Operators in MC++

What is the proper way to overload the assignment operator in MC++?  I have
a method of the form:

static MyClass& op_Assign(MyClass& a, MyClass& b)

Although, when I try to make a call from a C# client, the op_Assign method
never gets called.  It seems that objects in C# seem to correspond to
pointers in MC++, so I suppose the arguments just don't match when I try to
call them from C#.

So, my ultimate question really is how do I overload the assignment operator
in MC++ in such a way that I can call it from another .NET language like C#
in a "natural way"?

e.g.

//C# client

MyClass m1 = new MyClass();
MyClass m2 = new MyClass();

...

m2 = m1;

//end C# client

BTW, I also tried :

MyClass* op_Assign(MyClass* a, MyClass* b)

even though that didn't make sense to me, but it does not get called either.

Thanks,

Tim Rogers



Tue, 09 Aug 2005 20:35:57 GMT  
 HELP: Overloading Assignment Operators in MC++
What is the proper way to overload the assignment operator in MC++?  I have
a method of the form:

static MyClass& op_Assign(MyClass& a, MyClass& b)

Although, when I try to make a call from a C# client, the op_Assign method
never gets called.  It seems that objects in C# seem to correspond to
pointers in MC++, so I suppose the arguments just don't match when I try to
call them from C#.

So, my ultimate question really is how do I overload the assignment operator
in MC++ in such a way that I can call it from another .NET language like C#
in a "natural way"?

e.g.

//C# client

MyClass m1 = new MyClass();
MyClass m2 = new MyClass();

...

m2 = m1;

//end C# client

BTW, I also tried :

MyClass* op_Assign(MyClass* a, MyClass* b)

even though that didn't make sense to me, but it does not get called either.

Thanks,

Tim Rogers



Tue, 09 Aug 2005 22:14:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Overloading Assignment Operators in MC++

2. Question on Win32 memory management, overloaded assignment operator (=) and deep copying of a HANDLE

3. assignment operator overload

4. How Do I Overload the Assignment Operator in MC++?

5. VC++ 5.0 ambiguity: conversion operator vs overloaded operator?

6. == and != operator (operator overloading)

7. Overloading Operator Problem; Need Help

8. Help:overloading delete operator in vc++ 4.0

9. Help with operator overloading..

10. Help! Double-Linked List, Templates, and Operator Overloading

11. Help:overloading delete operator in vc++ 4.0

12. Help with MAP and overloaded operators

 

 
Powered by phpBB® Forum Software