should I use const if passed object will not be modified now, but can be modified later
<p>I am writing a game in which each data object is displayed by a ControlView. When a ControlView is set to display the data object, it should not change it. I want to use const to enforce this convention . However, in response to user interaction with the ControlView later, the data may be modified. So a non-const pointer needs to be stored. I am wondering if this is accepted and correct usage of const_cast?. skeletal code below </p>

<pre><code>class Data
{
  int m_int;
  public:
    void add(int i)  { m_int += i ; };
 };

class ControlView
{
 Data* m_data;
 public:
 void set_data(const Data* d)  //this call should not change d 
        { 
            m_data=const_cast&lt;Data*&gt;(d); //cast needed to compile
        }; 

        void manipulate_data(int x)
        { 
            m_data-&gt;add(x);
        }
};
</code></pre>
