Template Function Requirements ?

Yesterday I had an exam, the question was:

What do template functions require (meaning , where T is a must) ?
1) template <class T> void func(T& t);
2) template <class T> T& func();
3) template <class T> void func() { T t ,...... }
4) None of the above

I marked 1 :S, cause I thought that's how you "define" the function to be of the type you currently use......

Should I prepare for the 2nd c++ course ? :(
I think it's a stupid idea to contrive C++ questions like this to make the subject examinable. The question is stupid and doesn't improve your programming ability at all.

Having said that, you are correct.
Last edited on
Ofcourse it doesn't improve a lot, but that's the 'cheap' way to make exams - American questions....

Yet, there's the other wrong way to make exams, like what I had - write huge classes,..
The Dr's solution for the 3 hours exam, was 16 pages of code, and he said he "didn't write simple functions" ....

So I'm glad my exam was the short American questions exam....

And thanks a lot, hopefully we're right on this 1 ;D
Topic archived. No new replies allowed.