Is it possible to pass some parameters to constructor of a class inside a constructor of another class using malloc
? I can do that with new
. I need to do the same thing with malloc
:
(If it does not make sense, consider that I am using a custom allocator instead of malloc)
Class A_Class ... {
public:
B_Class *b;
...
A_Class: ...
{ b = new B_Class (c1, c2, c3);
} // end of constructor
}
Now with malloc:
Class A_Class ... {
public:
B_Class *b;
...
A_Class: ...
{ b = (B_Class*) malloc (sizeof(*b));
??????????????? }
}