After doing a bit of blind searching I've decided to ask this question here.
Okay, here is my query. I have a class (Card) that is which I am using as an object in a manager class. I also have an EventHanlder class that handles mouse input. I'm trying to get the manager class to send the card object by reference into the handler class which has a (*Card) pointer Card object. This is giving me an error C2440 operator = cannot convert from object to pointer object. Does this mean that in my EventHandler class that I need to overload the equals operator or is it that I have to overload the * dereference operator? Either way I have no idea where I'd begin with such a task.
P.S i'm aware people will ask for code examples but i'm not looking for help with the code I just require a point in the right direction with Operator Overloading.
All responses are appreciated. Thanks in advance.
If a method requires that a Card* be passed then pass a Card* to it. Use the & (address of) operator for this.
Example:
Method: void method(Card* pCard);
A card object: Card C;
Calling the method: method( &C );// pass the address when a pointer is required
No operator overloading is needed here, just pass what is needed.
I've not got my code in front of me at the moment it's on another machine but I'm pretty sure that is what I'm doing as that's one of the first things I learnt when learning Pointers and references. I'll take a look at my code. Maybe i've a syntax error somewhere. I'll get back to you. Thanks for the reply though