November 6th, 2020

User Defined Type Conversions

Useful when dealing with API's that expect data in one type but the code base is using another.

For example, using an API that expects a 3d vector as one type whilst using a different type throughout the rest of the code base.

My example inherits and adds user defined type conversion to the derived class. This is because I wanted to keep using the parent type in the code and add conversion to and from another type.

This Stack Overflow answer uses a templated wrapper to support conversion.