Right now my implementation returns the thing by value. The member m_MyObj itself is not const - it's value changes depending on what the user selects with a Combo Box. I am no C++ guru, but I want to do this right. If I simply stick a &
in front of GetChosenSourceSystem
in both decl. and impl., I get one sort of compiler error. If I do one but not another - another error. If I do return &m_MyObj;
. I will not list the errors here for now, unless there is a strong demand for it. I assume that an experienced C++ coder can tell what is going on here. I could omit constness or reference, but I want to make it tight and learn in the process as well.
Thanks!
// In header file
MyObj GetChosenThingy() const;
// In Implementation file.
MyObj MyDlg::GetChosenThingy() const
{
return m_MyObj;
}