Header, function, return value

Okay silly question. I am reading somebody's project trying to map stuff out and learn why they did certain things. Not sure if that is normal or not... :)

What would be the purpose of something like this in a header file? Is it possible define the returned variable m_strTName to use somewhere else from something like this? I just do not understand the purpose of this in the header file as it is not used anywhere that I can search..


1
2
   void    SetTName(char *pstrName);
   CString GetTName(){return m_strTName;};
Last edited on
That's a bit goofy if you ask me. Assuming the SetTName implementation sets m_strTName it will work, assuming this is in a c environment, it plain won't work in a c++ header unless you're using an unmentioned template, which would be exceptionally weird.

You could have m_strTName declared as a global variable, which is done sometimes for things like error codes in libraries like CuRL, if you are working in c++ you would want to declare it as extern in your header then declare it in your implementation file.
Last edited on
Thank you for the reply "ultifinitus".

I will look into this in more depth when I get the chance. I did not write this program but am trying to map myself through it to determine how certain aspects work. Yes it is C++. You gave me a little bit to think on and a new search avenue. Thanks for that.
Topic archived. No new replies allowed.