C++ operator for a = b .* c with pointers to a,b, and c objects as input -
i have 3 pointers 3 objects:
myclass* = new myclass(...); myclass* b = new myclass(...); myclass* c = new myclass(...); now want specify operator in myclass can do:
a = b*c; so a,b, , c existing large objects not want make additional copies of. want multiplication , directly write result 'a'.
1) possible c++ operators? 2) give me hints @ syntax? (i'm bit new operators..)
grateful help.
if wrote operator* myclass.
myclass* = new myclass(...); myclass* b = new myclass(...); myclass* c = new myclass(...); you should use below:
*a = (*b) * (*c); and can not pointers. example impossible:
myclass *operator*(const myclass *a, const myclass *b) // impossible { ... } because operator definition must have argument of myclass.
Comments
Post a Comment