| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Thomas Ruschival" |
| Date: |
01 Dec 2004 04:00:01 PM |
| Object: |
namespaces :: |
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
.
|
|
| User: "Rolf Magnus" |
|
| Title: Re: namespaces :: |
01 Dec 2004 07:28:24 PM |
|
|
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.
.
|
|
|
|
| User: "Jacek Dziedzic" |
|
| Title: Re: namespaces :: |
01 Dec 2004 04:12:04 PM |
|
|
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.
.
|
|
|
|

|
Related Articles |
|
|