How do I call main() in my main cpp file from a seperate cpp file?

前端 未结 5 983
失恋的感觉
失恋的感觉 2021-01-29 14:33

I\'m making a class that displays a message to the user and asks them if they want to return to the start of the program, but the message function is in a separate class from wh

5条回答
  •  遇见更好的自我
    2021-01-29 14:55

    Assuming that you could change dispMessage(void) to something like bool askForReturnToStart() then you could use that to build a loop within main, f.e.:

    int main() {
      Message dm;
      do {
        // whatever
      } while (dm.askForReturnToStart());
    }
    

提交回复
热议问题