I am using a third-party static library (.lib file) in a C++ project. The author of the static library added a method to a class for me and sent me an updated build of the library.
Unfortunately, he didn't send a new header file and communication with him is slow, so I may not get the new header soon. I know the method signature of the new method, so I could just add it to the header file.
My question is whether it matters where in the list of public methods I add the new declaration (top, bottom, middle...). My best guess is that it does and that the order in the header file determines the order in the compiled class. Can someone confirm or refute this?
My question is whether it matters where in the list of public methods I add the new declaration
AFAIK, it does not matter if the member function is regular function but it matters if it is a virtual
member function. The virtual member functions in the virtual table are in a certain order. If the library has them in a different order than your .h file, you'll most likely end up calling the wrong function.
Related: Force the order of functions in the virtual method table?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With