c++ - What's the difference between namespaces & classes? -


In C ++ 13/4 environment, what is the difference between a namespace and a square?

The way I see it;

  named place foo {int a: 4; Int b: 4; }  

and

  class bar {public: int a = 0; Int b = 0; }  

The same thing ...

Yes, they are used differently;

Namespace ....

  foo :: a = 20; Foo :: b = 30;  

class ....

  bar alpha; Alpha. A ... Alpha B ...  

But in general, what is the advantage of one over the other?

There are a lot of differences, there is a group system for namespace names, more or nothing less

  • can be done quickly.
  • can be obtained from.
  • Virtual tasks can be.
  • And so on.

    If you think yourself whether you should use namespace or a class, then you are probably exploring a way to control the scope of names - so the election is clear: Nameshot's Use the.


    Comments

    Popular posts from this blog

    java - org.apache.http.ProtocolException: Target host is not specified -

    java - Gradle dependencies: compile project by relative path -

    ruby on rails - Object doesn't support #inspect when used with .include -