Created
April 4, 2014 13:56
-
-
Save scj7t4/9975237 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
using namespace std; | |
template <class T> | |
class StaticThing | |
{ | |
public: | |
StaticThing() | |
{ | |
cout << "Static thing constructor"<<endl; | |
} | |
static int SomeMagic(T x) | |
{ | |
cout<<"Magic function!"<<endl; | |
return static_cast<int>(x); | |
} | |
}; | |
class SubClass : public StaticThing<float> | |
{ | |
public: | |
SubClass() | |
{ | |
cout<<"Subclass constructor"<<endl; | |
} | |
}; | |
int main() | |
{ | |
SubClass x(); | |
cout<<SubClass::SomeMagic(3.14)<<endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment