Re: Proposal for Include files/headers
edA-qa <edA-qa <at> disemia.com>
2004-09-06 16:03:49 GMT
Slawomir Lisznianski wrote:
> Let me clarify. One could use qualified names, in which case "using"
> could be omitted and name clashes prevented. In other words, you don't
> need to write "using" if you plan on explicitly qualifying a type.
Your explanation, not just the above, is omitting one of the common uses
of the using directive: to import a set of names, not just a single
object, where further names will be half-qualified, or not qualified.
Consider:
using Architecture.Car;
Door left,right;
...
using Architecture.House;
Door front, back;
...
using Architecture;
Car::Door left, right;
House::Door front, back;
> Also, I opt for importing namespaces and not individual classes because
> we *want* to pull any free functions, such as operator+, defined for
> those classes. In order to make it safe and efficient, we would have to
> go away from the existing C++ practice, where, for example, an entire
> std. library is in one namespace. A given bottom-level namespace would
> have a single type (primary) and any free functions defined for it. Here
> is a String type written in this fashion:
I've recently read such sections in C++ about free functions on classes.
(Continue reading)