Skip to content

Instantly share code, notes, and snippets.

@scj7t4
Created April 4, 2014 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scj7t4/9975237 to your computer and use it in GitHub Desktop.
Save scj7t4/9975237 to your computer and use it in GitHub Desktop.
#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