I have a GDI component I use for creating graphical objects on my form.
This component contains a Transformation_Matrix class. When I populate these matrix objects I have the ability to multiply them together to obtain a new transformation matrix.
E.g. Transformation_Matrix matrix1, matrix2, matrix3
... do stuff to populate matrix1 and matrix2
matrix1 * matrix2 = matrix3 // how did he (the programmer) do this?
The programmer who has written the GDI Component has written the Transformation_Matrix class in such a way so that when I consume these matrix objects I can multiply them together and it returns an new Transformation_Matrix object correctly containing the product of mulitipling the two matrices.
How do I build classes in such a way as when they are consumed in some other class or application the consumer/user can multiply my objects and receive a product of the multiplication?
To be more succinct how can I create custom complex objects that allow the ability to be multiplied, divided, added, subtracted, squared (or anything else), much like my GDI component does?