Last active
November 6, 2020 15:47
-
-
Save mrmikejones/4ff1790a971df4f3856864de8ab49470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Vector3_A { | |
float x; | |
float y; | |
float z; | |
}; | |
class Vector3_B { | |
Vector3_B(float x, float y, float x); | |
float getX(); | |
float getY(); | |
float getZ(); | |
private: | |
float m_coords[3]; | |
}; | |
class MyVectorWrapper : public Vector3_B { | |
public: | |
explicit MyVectorWrapper(const Vector3_A &inVal) | |
: Vector3_B(inVal.x, inVal.y, inVal.z) | |
{} | |
explicit operator Vector3_A() { | |
return Vector3_A { getX(), getY(), getZ() }; | |
} | |
}; | |
void foo() { | |
Vector3_A aVector; | |
MyVectorWrapper myVector(aVector); | |
// ... | |
Vector3_B bVector(myVector); | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment