Best practice to partially change a C++ library while keeping the rest of the library intact
<p>What is the best practice to add or modify a single class method in a well-established C++ library like OpenCV, while still reusing the remaining of the library code, preferably in the lib format. </p>

<p>At this point the only way I know is to copy all the source and header files that belong to the specific library (let's say OpenCV's core library) to the current source folder, modify that one function and recompile the module with the rest of the code. Ideally, I want to be able to link all the current .lib files the way they are, but simply define a new method (or modify a current method) for a class defined inside those libs in a way that my implementation of the method supersedes the implementation of the default library files. </p>

<p>Inheritance doesn't always seem to be an option, since sometimes the base class has private members that are required for the correct inherited class implementation.</p>
