为什么在C#中的主要方法始终是摆在类中而不是在C ++中 [英] why main method in c# is always placed inside the class but not in c++
本文介绍了为什么在C#中的主要方法始终是摆在类中而不是在C ++中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我们把的main()
方法总是类
在C#里面,而在C ++中,它始终放在外面在类
。
Why we put main()
method always inside the class
in C# while in c++ it always placed outside of the class
.
推荐答案
有关历史的原因。 C ++从C,它有一个全球性的的main()
功能演变。 C#是更年轻,是从头开始设计的。一个C#的设计特点是缺乏全局函数,所以主
函数都有属于一类。
For historical reasons. C++ evolved from C, which had a global main()
function. C# is much younger and was designed from scratch. One of the design features of C# is the absence of global functions, so the main
function has to belong to a class.
这篇关于为什么在C#中的主要方法始终是摆在类中而不是在C ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文