Why do C# and Java require everything to be in a class?
Posted
by Javier Badia
on Stack Overflow
See other posts from Stack Overflow
or by Javier Badia
Published on 2010-04-26T22:23:47Z
Indexed on
2010/04/26
22:33 UTC
Read the original article
Hit count: 160
It seemed like this question should have been asked before, but searching found nothing.
I've always wondered what's the point of making us put every bit of code inside a class or interface. I seem to remember that there were some advantages to requiring a main()
function like C, but nothing for classes. Languages like Python are, in a way, even more object oriented than Java since they don't have primitives, but you can put code wherever you want.
Is this some sort of "misinterpretation" of OOP? After all, you can write procedural code like you would in C and put it inside a class, but it won't be object oriented.
© Stack Overflow or respective owner