🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3560

Re: Namespaces within class definition???

#3560
From: Steve Clamage
Date: Fri, 01 Mar 1996 13:43
43 lines
2316 bytes
In article s3c@nnrp1.news.primenet.com, kj7bg@primenet.com (Bob White) writes:
>...  I tried the following and it seems to work:
>
>typedef	std::string XyzString;
>class xyz : public XyzString { }
>
>So I will use it until Borland and Microsoft allow me the more 
>straight forward way.  Also, I am using the "string" class as defined by one 
>version of the C++ standard which was put in the "std" namespace.  I thought
>this was what the current standard required!

Yes. The draft standard defines a string class called "string", and
all library elements are in the "std" namespace. You have basically
three ways to access names in the standard library:
1. Explicit qualification:
	std::string MyString;
2. A using-declaration:
	using std::string;
	string MyString;
3. A using-directive:
	using namespace std;
	string MyString;

The using-declaration (#2) places the specified name in the current scope
having its original declaration.

The using-directive (#3) makes all names from the namespace visible from
the current scope, which is subtly different from placing those names IN
the current scope. (And subtly different from placing them in a notional
surrounding scope.) See Stroustrup's "Design and Evolution of C++" for
more details.

Your typedef is a variation of #1.

---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ To submit articles: try just posting with your news-reader.
                      If that fails, use mailto:std-c++@ncar.ucar.edu
  FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu.
]
Technical Details
Message-ID: <4h4jl4$2iq@engnews1.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <4h2mlp$s3c@nnrp1.news.primenet.com>

Show Full Headers
Complete Article Headers
From: clamage@Eng.Sun.COM (Steve Clamage)
Message-ID: <4h4jl4$2iq@engnews1.Eng.Sun.COM>
X-Original-Date: 29 Feb 1996 16:18:44 GMT
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 01 Mar 96 13:43:43 GMT
Approved: fjh@cs.mu.oz.au
Return-Path: <daemon@meeker.UCAR.EDU>
Newsgroups: comp.std.c++
Subject: Re: Namespaces within class definition???
Organization: Sun Microsystems Inc.
References: <4h2mlp$s3c@nnrp1.news.primenet.com>
Reply-To: clamage@Eng.Sun.COM
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMTcDzuEDnX0m9pzZAQGvVQGAmdcGtKbRK1dVHQUf1UeTAG9tEUkDEz17
 eS9ehkm3G4ETg2aQKhHxwWD2j4lwEpcE
 =CLJG