Guest
Hi everyone - I am trying to overload the cast operator on a class. However, I would like to do it with pointers. For instance, I want:
Class1* var1;
Class2* var2;
var2 = (Class2*)var1;
When the cast happens, I want to execute a chunk of code which will assert that Class1 is actually an instance of Class2. I have seen lots of examples where the actual object cast can be overloaded, but not a pointer to the object.
Any thoughts? Your help is always apprecitated!
-Tim
Class1* var1;
Class2* var2;
var2 = (Class2*)var1;
When the cast happens, I want to execute a chunk of code which will assert that Class1 is actually an instance of Class2. I have seen lots of examples where the actual object cast can be overloaded, but not a pointer to the object.
Any thoughts? Your help is always apprecitated!
-Tim