Hello Everyone, I was wondering why there seems to be a preference to setting values in constructors rather than inside the class itself. Both work equally well in my experience.
first: it's because you can't initialize non-static members in the class itself before c++11, you could only do it in the constructor.
Nowadays yes, you could write it like this if you want but it would only work with c++11 or newer so your class can't be used in older projects.
If you don't care just go on, do it, I hope C++11 won't be experimental some day.
If you want your class to support all c++ standards you should probably make a constructor.
second: it's because the Method Node() is not a template method.
it's your class that is a template so every Node<T> has a method named Node()
you could write it like yours if you did it like this but that would make little sense and it would probably not compile: