Interactive Brokers Interview Question
there can be a case where it may be necessary to recompile the libraries even in the case of adding a constructor i.e option a. That will happen when initially there was no constructor in the class but later a constructor with an argument is added. Then any code that was creating an object using the default constructor will no longer be able to do so. Therefore, we would need to recompile the libraries.
a) It is safe, because nothing will be changed in the object structure. The libraries will not be aware that new constructor is available.
- fiddler.g July 31, 2010b) This will change the structure of the object. So, it will be problem if the size of this class used anywhere in the library. Or if the member added before any other member.
c) If the previous version of the class was not polymorphic, this will change the structure (vptr), so it is not safe, otherwise you will decrease the number of possible bugs in libraries :)
d) It is safe if this argument appended at the end of the argument list.