Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 6th, 2006, 03:35 PM
heng
Guest
 
Posts: n/a
Default scope resolution operator

A::B
I can understand that B is a member of the scope A
But, sometimes I read the expression like ::C, what does this mean when
the scope is absent?
Thanks.

  #2  
Old December 6th, 2006, 03:55 PM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: scope resolution operator

heng wrote:
Quote:
A::B
I can understand that B is a member of the scope A
But, sometimes I read the expression like ::C, what does this mean
when the scope is absent?
It means "global".

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  #3  
Old December 6th, 2006, 03:55 PM
Howard
Guest
 
Posts: n/a
Default Re: scope resolution operator


"heng" <likemursili@gmail.comwrote in message
news:1165420718.962550.66910@n67g2000cwd.googlegro ups.com...
Quote:
A::B
I can understand that B is a member of the scope A
But, sometimes I read the expression like ::C, what does this mean when
the scope is absent?
Thanks.
>
That's "global scope". (Or is it "global namespace"? I forget.) It's used
to differentiate it from an identically named function or object in the
current scope. For example, there is the global function strcpy(). It is
possible (though perhaps not adviseable) that you have a class (or
namespace) which implements a function also named strcpy(). Using ::strcpy
from inside a function of that class or namespace would mean you're caling
the global strcpy() instead of your class' or namespace's strcpy().

-Howard


  #4  
Old December 6th, 2006, 03:55 PM
heng
Guest
 
Posts: n/a
Default Re: scope resolution operator

Thanks a lot.

Howard wrote:
Quote:
"heng" <likemursili@gmail.comwrote in message
news:1165420718.962550.66910@n67g2000cwd.googlegro ups.com...
Quote:
A::B
I can understand that B is a member of the scope A
But, sometimes I read the expression like ::C, what does this mean when
the scope is absent?
Thanks.
>
That's "global scope". (Or is it "global namespace"? I forget.) It's used
to differentiate it from an identically named function or object in the
current scope. For example, there is the global function strcpy(). It is
possible (though perhaps not adviseable) that you have a class (or
namespace) which implements a function also named strcpy(). Using ::strcpy
from inside a function of that class or namespace would mean you're caling
the global strcpy() instead of your class' or namespace's strcpy().
>
-Howard
  #5  
Old December 6th, 2006, 06:47 PM
Default User
Guest
 
Posts: n/a
Default Re: scope resolution operator - TPA

heng wrote:
Quote:
Thanks a lot.
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or the group FAQ list:
<http://www.parashift.com/c++-faq-lite/how-to-post.html>
 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles