title: How to call function inside function in C++ ?
body: <p><strong>Problem:</strong> Through C++ function I need to run  thread  function which in turn calls another  Singleton C++  function . This called function will call C function (Which runs a infinite loop to change embedded system status in every 10 millisecond).    </p>
  
  <p><strong>Question:</strong> How would I call a function inside the function in C++? Do I need to assign instance for calling 2nd function? </p>
  
  <p>Please refer the sample code and give your thoughts whether its right or wrong.<br>
  I have  a singleton class say  Singleton</p>
  
  <pre><code>class Singleton
  {    
    private :  // constructors and values
    public :
            void runThread();
            Singleton  getInstance();
            bool ChangeStatus( int a);    
    };
  
   void Singleton:: runThread()
   {     
      changeStatus( 7); // is this is right way to call function inside function
   }
  
   bool Singleton:: changeStatus( int a);
   {
       // This calls C function which changes  the status of embedded system
   }    
  
   void main()
   {
       // create instance of singleton class
  
     Singleton *instance1 = Singleton::getInstance();
  
     instance1.runThread();     
     /* will this call the function  changeStatus and will this      
        changeStatus function  will change status of  embedded system 
        assuming the c function to change status is working fine.
     */
   }
  </code></pre>
  
  <p>Please ignore the basic syntax error.<br>
  When I call the <code>runThread</code> function from main will it successfully calls the changeStatus function or do I Need to specify one more instance inside <strong>runThread</strong> to call changeStatus something like Singleton
    <code>instance2 = Singleton::getInstance(); instance2-&gt;changeStatus</code></p>