Not sure if malloc() works like new opeartor in C++ in terms of calling a default constructor. I guess it would call at least a base/default constructor but your code would give you a compiler error as default constructor is missing.
In C++, the new operator can be given to call a parameterized constructor for the class/object being allocated.
Just try adding a default constructor and compile it. I guess it would be OK.