title: Construct object, where one of its properties depends on another. In C++
body: <ul>
  <li>Beginner in C++</li>
  </ul>
  
  <p>I have a class, say </p>
  
  <pre><code>class A
  {
    public:
  
    int N;
    double ..... 
  };
  </code></pre>
  
  <p>But I would like the ..... to define a matrix of size depending on N. In case that changes the approach, it is a non-identical function of N and not just N itself, say N^3+1.</p>
  
  <ul>
  <li>In case that is the approach, I have never written a constructor of an object in C++. Therefore, if this is the approach could you please give some detail. I don't understand how it might work. When the class is instanciated, maybe the property N hasn't been even initialized.</li>
  <li>I am not clear how to get a matrix or array (I am still not clear of the basic data types of C++) of size determined in execution.</li>
  </ul>
  
  <p><strong>Edit:</strong> The value of N is determined later in the code. It is something like:</p>
  
  <pre><code>A InstanceOfA; //The variable InstanceOfA is declared of type A.
  ...
  Some other stuff happens, e.g. other properties of InstanceOfA are initialized 
  and some of the functions are used. And then:
  ...
  A.setN(4);
  </code></pre>
  
  <p>I didn't understand from the answer below. Would I need to do </p>
  
  <pre><code>A InstanceOfA(4);
  </code></pre>
  
  <p>?</p>