why main method in c# is always placed inside the class but not in c++

前端 未结 6 756
野的像风
野的像风 2021-01-01 23:49

Why we put main() method always inside the class in C# while in c++ it always placed outside of the class.

6条回答
  •  醉酒成梦
    2021-01-02 00:54

    The C++ language designers followed the lead of C and so the main function is a plain function.

    The C# language designers made the choice, when designing the language, that all methods must be part of classes.

提交回复
热议问题