role of const

Please explain the role of const in both code portions
and role of *this as this points to member of parent class.



1
2
3
4
1)  int name() const
    {}

2)  void study(const data_type& add_value){(*this)->write( ad_value ); }


Regards
cam
Last edited on
That sounds like a homework question. Besides, the code fragment lacks context; these must be member functions. Furthermore, there might be a syntax error (impossible to say without knowing the classes).

Overall, you should know what a const variable is and what a reference parameter is. Then expand to member functions of a const object and restriction const sets on the use of a reference parameter, respectively.
Topic archived. No new replies allowed.