Calling template function within template class

obj.bar<double>(1,2); // This line is faulty.

The template keyword is required here, as obj is an instance of a type Foo<T> which depends on the template parameter T, and so the above should be written as:

obj.template bar<double>(1,2); //This line is corrected :-)

Read @Johannes’s answer here for detail explanation:

  • Where and why do I have to put the “template” and “typename” keywords?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)