Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

main

c#

oop

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

like image 394
r_rohit Avatar asked Jan 25 '12 12:01

r_rohit


1 Answers

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.

like image 167
David Heffernan Avatar answered Oct 18 '22 06:10

David Heffernan