Hello
If I have the following data structure:
What is the right way to return m_options by reference?Code:class options { public: void set_value(int v) { m_value = v; } int get_value() { return m_value; } private: int m_value; }; class someclass { public: options &get_options() { return m_options; } private: options m_options; };
Isnt this right:
so that I'm allowed to call get_options().set and get functions?Code:options &get_options() const { return m_options; }
Where should I put the 'const' in this case?
Thanks for help!



LinkBack URL
About LinkBacks



