Let's say I have a class A
which should hold an instance of class B
(pointer or straight), and for some reasons B
cannot be initiated in A
's MIL, but later in the constructor's body.
For what I understand I have 2 options:
- Init
B
in MIL (with empty or partial constructor), and set up relevant fields later. - Hold
B*
and dynamically allocate it when I have all the information. This will requirenew
though.
I guess option 1 is better performance-wise. If performance is not an issue, which should I prefer?