1. What does actually a friend (keyword) do (isnīt a good friend to me :-) )? I think it has something to do with classes and functions??? Have found some examples but I really cannot grasp it.
2. I have a function that returns a template
My problem is when a call the function, CreateAPersontemplate<int>(). Why cannot I just call CreateAPersonTemplate()??? Why do I have to tell the compiler which type Iīm sending? The type is defined in the function.Code:template <class T> Person<T> CreateAPersonTemplate() { Person<int> Steve(35); return Steve; } //Also a class Person template <class T> class Person { public: Person(T age) {itsAge=age;} ~Person(){} void SetAge(T age) {itsAge = age;} T GetAge() const {return itsAge;} private: T itsAge; };
Thx in Advance



LinkBack URL
About LinkBacks



