diff options
-rw-r--r-- | c,cc/derive_from_templated_class.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/c,cc/derive_from_templated_class.cc b/c,cc/derive_from_templated_class.cc new file mode 100644 index 0000000..3e292c8 --- /dev/null +++ b/c,cc/derive_from_templated_class.cc @@ -0,0 +1,31 @@ +#include <vector> +#include <iostream> + +using namespace std; + + +template<class T> +class A { + T m_; +}; + +template<class T> +class B : public A<T> { + T n_; +}; + +template<class T> +void f(vector<B<T>*> v) +{ + for (typename vector<B<T>*>::iterator it = v.begin(); it != v.end(); it++) { + // do sth + } +} + + + +int main(void) +{ + vector<B<int>* > v; +} + |