Skip to content

Instantly share code, notes, and snippets.

@r2p2
Created July 2, 2010 23:03
Show Gist options
  • Save r2p2/462050 to your computer and use it in GitHub Desktop.
Save r2p2/462050 to your computer and use it in GitHub Desktop.
// g++ main.cpp -std=gnu++0x
#include <vector>
#include <memory> // shared_ptr
template <class T>
class Base
{
public:
Base(T value)
:m_value(value)
{}
T value()
{
return m_value;
}
void value(T new_value)
{
m_value = new_value;
}
protected:
T m_value;
};
class Integer : public Base<int>
{
Integer(int new_value)
:Base<int>(new_value)
{}
};
int main() {
std::vector<std::shared_ptr<Base<auto> > > list;
return list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment