we can inherit a new class from the class template. here is a sample example :

#include<iostream>
using namespace std;

template <typename T>
class A{
  private:
     int b;
    public:
     T a;
     A(){ }
     ~A(){}
     int print();
};
template< typename T> int A<T>::print()
{
  return a;
}
template< typename P> class B: public A<P> {
    private:
       P c;
    public:
       B(){ }
      ~B(){ }
};
int main()
{
   B<int> *obj = new B<int>();
   cout<<obj->print();
  return 0;
}


Related Contents to follow