Skip to content

Instantly share code, notes, and snippets.

@sticilface
Created February 27, 2016 01:32
Show Gist options
  • Save sticilface/55c8ff7643c62473f98d to your computer and use it in GitHub Desktop.
Save sticilface/55c8ff7643c62473f98d to your computer and use it in GitHub Desktop.
#pragma once
class handler
{
public:
virtual ~handler() {
Serial.println("[handler] Deconstructor Called");
}
private:
};
template<class T>
class derived: public handler
{
public:
derived() {
Serial.println("[derived] constructed");
}
~derived() override {
Serial.println("[derived] Deconstructor Called");
}
private:
};
template<>
class derived<int>:public handler
{
public:
derived() {
Serial.println("[derived<int>] constructed");
}
~derived() override {
Serial.println("[derived] Deconstructor Called");
}
private:
};
class holding
{
public:
holding() {
_handle1 = new derived<long>();
_handle2 = new derived<int>();
delete _handle1;
delete _handle2;
}
private:
handler * _handle1;
handler * _handle2;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment