有很多主要课程的建筑项目 [英] building project having many main class

查看:89
本文介绍了有很多主要课程的建筑项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个包含类的项目,每个类都有自己的主要方法.

是否可以在不指定起始类(带有main的类)的情况下编译项目?

(我可以在执行过程中指定起始类).

使用Java的Eclipse IDE可以做到这一点.仅在执行期间需要指定起始类.

有人可以帮我吗?

推荐答案

您只能有一个Main方法.但这并不能阻止您根据运行时中的某些参数启动不同的类.主要方法只是应用程序的开始.在此方法中,您可以决定下一步要做什么,要启动哪个窗体或要实例化哪个类并使用它.
由于VS现在为每个项目添加了Program类,因此从VS 2005删除了Starting Form的project属性.主要方法是放置.在此主要方法中,您将看到哪个表格将首先被激活.
You can have only one Main method. But this doesn't stop you from starting different classes depending on some parameter in runtime. Main method is just the begining of app. In this method you can decide what to do next, which form to start or which class to instance and use it.
From VS 2005 has removed the project property of Starting Form, because now VS adds Program class for every project where the main method is placed. In this main method you will see which form will be activated first.


这篇关于有很多主要课程的建筑项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆