Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Insider News
  4. Everything in a class? – C++ is not Java!

Everything in a class? – C++ is not Java!

Scheduled Pinned Locked Moved The Insider News
c++javaquestionannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kent Sharkey
    wrote on last edited by
    #1

    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

    F L 2 Replies Last reply
    0
    • K Kent Sharkey

      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

      F Offline
      F Offline
      FIorian Schneidereit
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • K Kent Sharkey

        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

        L Offline
        L Offline
        Lazarus666
        wrote on last edited by
        #3

        namespace global
        {
        public:
        bool foo, bar, baz;
        };

        using global;

        int main ()
        {
        foo = false;
        return 0;
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups