Free functions versus member functions

BCS ao at pathlink.com
Thu Oct 11 13:45:43 PDT 2007


Reply to Jari-Matti Mäkelä,

> Bill Baxter wrote:
> 
>> Another difference is that in C++ you have to *explicitly* say you
>> want to bring members of a namespace into your current namespace with
>> a "using" directive.
>> 
>> In contrast, D's imports throw all the symbols into the local
>> namespace by default.  You have to do something extra to prevent it
>> ("static import" instead of import).
>> 
> I haven't been using C++ lately, but isn't 'using namespace' similar
> to D import - it imports all symbols from the namespace. Explicit
> syntax is nameSpace::symbol IIRC.
> 
As I understand it the difference is that in D you can't access somthing 
without an import. In C++ you can access it, but you need the FQN if you 
don't use using.





More information about the Digitalmars-d mailing list