Created
December 9, 2015 22:18
-
-
Save daviddoria/4ea5d826684993b1e4ef 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
#include <iostream> | |
struct Point | |
{ | |
public: | |
double x,y,z; | |
}; | |
// A mixin to add an 'A' value to a point | |
template<class Base> | |
class A : public Base | |
{ | |
public: | |
template <typename T_RHS> | |
A& operator=( const T_RHS& rhs ) | |
{ | |
Base::operator=(rhs); | |
} | |
double a; | |
}; | |
int main() | |
{ | |
Point point; | |
A<Point> aPoint = point; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment