Everything in a class? – C++ is not Java!
-
Arne Mertz[^]:
In Java there are no free functions, which simplifies lookup rules and code organization. Many C++ style guides have adopted the “only classes” style, prohibiting free functions. But C++ is not Java.
I'm sorry if that news startles you
-
Arne Mertz[^]:
In Java there are no free functions, which simplifies lookup rules and code organization. Many C++ style guides have adopted the “only classes” style, prohibiting free functions. But C++ is not Java.
I'm sorry if that news startles you
There's no accounting for taste, including style guides. But actually he's comparing apples and oranges here. Java, and also C#, simply have no choice, "everything is a class" is not a rule but a principle for them because they are inherently object-oriented languages. C++, on the other hand, is... something else. :D
-
Arne Mertz[^]:
In Java there are no free functions, which simplifies lookup rules and code organization. Many C++ style guides have adopted the “only classes” style, prohibiting free functions. But C++ is not Java.
I'm sorry if that news startles you
namespace global
{
public:
bool foo, bar, baz;
};using global;
int main ()
{
foo = false;
return 0;
}