title: How to call a class method "display" in such a situation
body: <p>I am making winapi app and I my code is structured like this. There is the MainClass and it has a few Child classes that display different controllers such as buttons and etc.
  When I click on the button made by the Child class how can I call method &quot;display()&quot;?</p>
  <pre><code>class MainClass{
  public:
   string currentWindow;
   Child1* Child1Win;
   Child2* Child2Win;
   void display(){
    clear();
    if(currentWindow == &quot;child1&quot;){
     Child1Win = new Child1Win();
     Child1Win-&gt;addControls();
    }
    if(currentWindow == &quot;child2&quot;){
     Child2Win = new Child2Win();
     Child2Win-&gt;addControls();
    }
   }
   void clear(){
    delete Child1Win;
    delete Child2Win;
   }
  }
  
  class Child1{
  public:
   Child1(){}
   ~Child1(){ // cleaning }
  
   void addControls(){
    //setting up some controls
   }
   void someMethod(){
    // ! CALL HERE display() to change controllers
   }
  }
  
  class Child2{
  public:
   Child2(){}
   ~Child2(){ // cleaning }
  
   void addControls(){
    //setting up some controls
   }
   void someMethod(){
    // ! CALL HERE display() to change controllers
   }
  }
  </code></pre>