title: How to add method to a class (Helper function)?
body: <p>How can I add my own method to a pre-existing class without any change in context of pre-existing class.</p>
  
  <p>for example :</p>
  
  <pre><code>   A.hpp
          class A
          {
          public :
          void print1()
          {
            cout &lt;&lt; "print1";
          }
          };
  
      B.hpp
          //add a helper function to class A
          //for example:
          A::print2()
          {
          cout &lt;&lt; "print2";
          }
  
       main.cpp
  
          #include "A.hpp"
          #include "B.hpp"
          main()
          {
             A a1;
             a1.print2();
          }
  </code></pre>