Namespace vs Class
For example, since Util and Text are collections of functions, and not collections of objects, shouldn't the be defined as a namespace, instead of a class. ?
Namespace vs Class
Moderator: Moderators
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Re: Namespace vs Class
They should indeed. Besides the fact that neither Util nor Text describe a single concept or even something you might want to create an object of, a namespace has also several advantages above a class (can be re-opened, is more convenient to use with "using" declarations, functions are "static" by default).Pothead wrote:Namespace vs Class
For example, since Util and Text are collections of functions, and not collections of objects, shouldn't the be defined as a namespace, instead of a class. ?
Re: Namespace vs Class
That's a bad example, reading a bit more . . . . even classes of objects and templates should be in namespaces. A namespace is used to group a bunch of code which is "logically related".Pothead wrote:are collections of functions, and not collections of objects
And ideas about the results of this discussion ?GargoyleMT wrote:We have had a discussion about this in the past, but my log greppage isn't helping turn up the conversation.
Thanks for the clear response. hehe, and telling me new stuff (about being static by default)FarCry wrote:They should indeed. Besides the fact that neither Util nor Text describe a single concept or even something you might want to create an object of, a namespace has also several advantages above a class (can be re-opened, is more convenient to use with "using" declarations, functions are "static" by default).
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Re: Namespace vs Class
What FarCry said. cologic probably had something to say, maybe Trem or arne too. But that was the gist of it.Pothead wrote:And ideas about the results of this discussion ?