Article View: borland.public.cppbuilder.oodesign
Article #47Re: Meaning
From: Shannon Peterson
Date: Wed, 16 Mar 2005 16:17
Date: Wed, 16 Mar 2005 16:17
54 lines
2437 bytes
2437 bytes
Thanks, it all makes sense now.
Shannon
Thomas Maeder [TeamB] wrote:
> Shannon Peterson <speterson@ae-solutions.com> writes:
>
>
>>AnsiString mystring = ::func(stuff() + "string");
>>
>>all over the place and I was wondering if the :: is just allocating
>>space for data returned by the function call?
>
>
> Not at all.
>
>
> The expression
>
> func("string")
>
> means that a function named func() is to be called, and "string" is to
> be passed as argument.
>
>
> This sounds simple, but it's not. Because in C++, we have
> overloading.
>
> The compiler thus first has to look for functions named func in a
> sequence of namespaces. As soon as one or more functions named func
> have been found in a namespace, this search stops. Among the functions
> found, those that can't take "string" as an argument are discarded
> from the candidate functions. If this process ends up with exactly one
> function, that function is called.
>
> Prefixing func with :: changes the sequence of namespace where the
> search for func is performed: func() is only looked for the global
> namespace.
>
>
>
>>is it the same as void::Func()?
>
>
> No.
>
> void::Func()
>
> is a sytax error, while
>
> AnsiString mystring = ::func(stuff() + "string");
>
> is syntactically correct.
Technical Details
Message-ID:
<42385be9$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<423855ca@newsgroups.borland.com> <m2wts74lq4.fsf@madbox2.local>Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,731abaf2ddfa2fb1 X-Google-Attributes: gid10db1e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 16 Mar 2005 10:17:36 -0600 From: Shannon Peterson <speterson@ae-solutions.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.oodesign Subject: Re: Meaning References: <423855ca@newsgroups.borland.com> <m2wts74lq4.fsf@madbox2.local> In-Reply-To: <m2wts74lq4.fsf@madbox2.local> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 12.2.62.130 Message-ID: <42385be9$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1110989801 12.2.62.130 (16 Mar 2005 08:16:41 -0800) Lines: 54 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder2.on.meganewsservers.com!meganewsservers.com!textfeed1.on.meganewsservers.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail