Answers for "c++ how to inherit from a template class"

C++
2

templates classes in c++

// function template
#include <iostream>
using namespace std;

template <class T>
T GetMax (T a, T b) {
  T result;
  result = (a>b)? a : b;
  return (result);
}

int main () {
  int i=5, j=6, k;
  long l=10, m=5, n;
  k=GetMax<int>(i,j);
  n=GetMax<long>(l,m);
  cout << k << endl;
  cout << n << endl;
  return 0;
}
Posted by: Guest on December-15-2020
0

c++ how to inherit from a template class

template inheritance
Posted by: Guest on January-28-2021

Code answers related to "c++ how to inherit from a template class"

Browse Popular Code Answers by Language