JP Morgan Interview Question
Financial Software DevelopersHere statement d is bit confusing. Let us assume all the scenario.
1) A default value is assigned to the existing argument in the member function
In this case there is no need to recompile the libraries. As the signature of the member function still remains the same.
2) A new argument is added with a default value.
Here recompilation is required for sure. The reason is as mentioned above changes to the member function interface i,e adding a new argument would require to recompile the library.
Looks like none actually.
Reasons:
a) Addition of second constructor would be an overloaded one. First constructor(Assuming one already was there still holds good for the client application)
b) New data member addition doesn 't require clt application to rebuild
c)Destructor is called internally when the object is deleted or goes out of scope. So no need to rebuild again
and finally
d)member function with default argument would again would not require clt code change
In C++, it would be all above.
Basically they all involve changes to the header file while will be included by the libraries use it.
Only exception is if a library only holds pointer or reference to this class but do not call any methods. It can get away with only forward declaration, hence no need to recompile the translation unit.
b and c
- Anonymous May 30, 2009b changes the object size and memory layout of other members. c changes the layout of vtable and how destructor is found.