title: How to Call Function of one class on the object of another class?
body: <p>How can I call one method in one class over using another class ?</p>
  
  <p>I have ;</p>
  
  <pre><code>class A { 
   public :
    foo ( ) ;
  };
  
  class B {
   public :
    bar ( ) ;
  };
  </code></pre>
  
  <p>in main :</p>
  
  <pre><code>A data ;          // I am creating instance of class A 
  
  data . bar ( ) ;  //  but, I am calling a method of another class
  
                    // how can I do that ?
  </code></pre>
  
  <p>Note : I could not find a appropriate title. If you have one, feel free to share or edit </p>