Try to understand the main function is static and cannot be called but in main functions you can call functions and constructors.
So,
Try storing the code of main function in functions or...