I am new to how C++ stubs functions are used .
I went through the link How to create stub shared libraries on Linux but
1) I could not get exact complete example code in c++ in which stubs are written in C++ code . If someone can point me to exact sample example?
2) Also I was looking how exactly the stubs are replaced by exact same name shared library functions on Linux?
It will be helpful if someone can help me in my two questions.
The answer to your question comes with an understanding of the black art of dynamic linking. Read Ulrich Drepper's How to Write Shared Libraies for a thorough treatment of the subject.