title: How do I assign an initial value to a dynamic variable without using assignment operator?
body: <p>I am creating a dynamic variable in the heap via a pointer.</p>
  
  <pre><code>int* p = new int;
  </code></pre>
  
  <p>I'm sure we're all familiar with that. However, I want to create the dynamic variable and give it an initial value <em>all in one step</em>!
  I do not want to later use the assignment operator.</p>
  
  <pre><code>*p = 5;
  </code></pre>
  
  <p>I want all of my dynamic variables to have the same initial value, avoiding the extra overhead of the assignment operator.</p>
  
  <p>How would you do this if the dynamic variable were a class instead of an int? I know that it's possible to create and initialize a class variable of the stack in one step:</p>
  
  <pre><code>class Dog {...};
  
  Dog d1("Spot", 5);
  </code></pre>
  
  <p>Can you do the same if the <code>Dog</code> object were a dynamic one instead?
  My program needs to dynamically allocate and initialize variables of both POD and class types.</p>