differences between new and malloc in c++ : <pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
using namespace std;

class Box {
   public:
      Box() {
         cout &lt;&lt; "Constructor called!" &lt;&lt;endl;
      }
      void printer(int x)
    {
        cout&lt;&lt;x&lt;&lt;" printer"&lt;&lt;endl;
    }

      ~Box() {
         cout &lt;&lt; "Destructor called!" &lt;&lt;endl;
      }

};

int main( ) {
    Box* myBoxArray = new Box[4];

    Box* myBoxArray2 = (Box*)malloc(sizeof(Box[4]));
    myBoxArray2-&gt;printer(23);
    *myBoxArray2;
    *(myBoxArray2).printer(23);

   return 0;
}
</code></pre>

<p>the problem simply is that when i use 'new' the constructor is printed out but when i simple derefrence the pointer to <code>myBoxArray2</code> the constructor is not printed and neither is the funtion <code>printer</code> printed. 
Also why is it that when i use <code>-&gt;</code> the funnction printer runs but not when i use the equivalent <code>*(myBoxArray2).printer(23)</code></p>
