Created
August 26, 2018 10:03
-
-
Save kobake/edda55f0c47094067acb715d99e0c9b7 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 <stdio.h> | |
#include <vector> | |
class IDumpable { | |
public: | |
virtual void Dump() = 0; | |
}; | |
// For inheritance | |
template <class T> | |
class Hoge : public IDumpable, public std::vector<T>{ | |
public: | |
void Dump() { | |
printf("size = %d\n", this->size()); | |
} | |
}; | |
int main() | |
{ | |
Hoge<int> a; | |
a.push_back(10); | |
a.push_back(20); | |
IDumpable* d = &a; | |
d->Dump(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment