Created
February 27, 2016 01:32
-
-
Save sticilface/55c8ff7643c62473f98d 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
#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