A
A
artemmensk2014-05-08 16:25:54
C++ / C#
artemmensk, 2014-05-08 16:25:54

How to pass a class object to a template function?

How to write the MyClass class so that it can be passed to a function as in the example below?

template<typename T>
double suma(T obj);


int main(){
  MyClass myClass;
  suma(myClass);
}

template<typename T>
double suma(T obj){
  return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wexter, 2014-05-08
@artemmensk

suma<MyClass>(myClass)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question