Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > namespaces ::

Reply
Thread Tools

namespaces ::

 
 
Thomas Ruschival
Guest
Posts: n/a
 
      12-01-2004
Hi,
for now I know what namespaces are and a little how they are used and imported.
Am I right in the assumption that everything defined in the STL is in namespace std? (like vector and string etc.)

One thing is still unclear, I came across it in some sample code for network socket programming:
the author uses just two colons in front of a c-Function while he has a methos in a c++ class that has the same name. in the own method Socket::bind() the has a statement ::bind().

what do these 2 colons refer to?

T.i.a.
Thomas
 
Reply With Quote
 
 
 
 
Jacek Dziedzic
Guest
Posts: n/a
 
      12-01-2004
Thomas Ruschival wrote:
> One thing is still unclear, I came across it in some sample code for network socket programming:
> the author uses just two colons in front of a c-Function while he has a methos in a c++ class that has the same name. in the own method Socket::bind() the has a statement ::bind().
>
> what do these 2 colons refer to?


To the global bind().

HTH,
- J.
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      12-02-2004
Thomas Ruschival wrote:

> Hi,
> for now I know what namespaces are and a little how they are used and
> imported. Am I right in the assumption that everything defined in the STL
> is in namespace std? (like vector and string etc.)


Well, everything that can be. There are some preprocessor macros, and the
preprocessor doesn't support namespaces.

> One thing is still unclear, I came across it in some sample code for
> network socket programming: the author uses just two colons in front of a
> c-Function while he has a methos in a c++ class that has the same name. in
> the own method Socket::bind() the has a statement ::bind().
>
> what do these 2 colons refer to?


It means that the bind() function is looked for in the global namespace and
not in the Socket class.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
namespaces valentin tihomirov VHDL 0 05-24-2004 10:16 AM
@Import Syntax and Importing Namespaces in global.asax file D. Shane Fowlkes ASP .Net 1 01-13-2004 02:55 PM
newbie - help - where do u store custom classes when importing namespaces in ASP ravi sankar ASP .Net 2 08-27-2003 10:39 AM
Conflicting namespaces?? Will ASP .Net 2 08-13-2003 02:42 PM
Best Practices - solution - namespaces - classes Craig Deelsnyder ASP .Net 1 08-04-2003 11:27 AM



Advertisments