Operator functions in UML diagrams.

I have to make a card class and I've been given a UML diagram to follow. I don't think I understand how to write a particular function or how to use it when it comes to operators.




+operator = (in c: Card): Card

In my .h file I have this function as this and I'm sure it's not right.

Card operator = (in c : Card);
Assuming that's the assignment operator, then:

1
2
3
4
5
6
class Card
{
     public:
          Card& operator=(const Card& c);
...
};


and to use it:

1
2
3
4
Card c1;
Card c2;

c2 = c1; //equivalent to c2.operator=( c1 ); 
Last edited on
Topic archived. No new replies allowed.