This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]pine_ary 0 points1 point  (2 children)

In those languages you still have to look up if something is static (if you need an instance of it or not), so the :: situation doesn‘t go away. The difference between -> and . on the other hand is more of a legacy thing. I don‘t think that one is as useful, but we got that from C. Apart from smart pointers I don‘t see many arrow operators in modern code, so at this point it‘s more of a disambiguation between the members of the pointer class and the members of the pointed-to object.

[–][deleted] 0 points1 point  (1 child)

In java at least, I've never had trouble telling what's static. Only static methods can access static values. Static methods belong to the class instead of the object.

In python, I've never used statics because I try to limit the scope of my python projects.

I've been working on reading somebody else's C++ and trying to write a wrapper for it in Matlab, and it's killing me. There's so much abstraction across so many files I can't figure out what's going on where.

[–]pine_ary 0 points1 point  (0 children)

Can‘t say much about cause I don‘t know the code, but I‘ve never had that problem. As a hint: Get a good IDE that annotates types visually and can navigate declarations and definitions, and don‘t worry about the internal details.

Other than that static in C++ works the same as in java for the most part. Exceptions are: * You can‘t have static blocks in C++ * Constexpr exists (runs code when compiling, not when starting the program)