🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Namespaces within class definition???

#3548
From: Bob White
Date: Thu, 29 Feb 1996 06:23
52 lines
2733 bytes
Thanks for the fast response.  I guess Microsoft has a bug which I will let 
them know about.  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!   Maybe that's what I get for
thinking.  Anyway, thanks for the help!

[Moderator's note: remainder of article contains only quoted text. -fjh.]

In article <4h2ajf$l69@engnews1.Eng.Sun.COM>, clamage@Eng.Sun.COM says...
>
>In article ejv@nnrp1.news.primenet.com, kj7bg@primenet.com (Bob White) 
writes:
>
>>Assuming that the "string" class is properly defined in namespace "std", is 
it 
>>legal to do the following:
>
>>class xyz : public std::string {
>>}
>
>>I am trying to do this with Visual C++ v4.0 and it is giving me an INTERNAL 
>>COMPILER ERROR.  I thought that this was legal syntax, but am not certain.
>>Thanks in advance for your help.
>
>Yes, it's valid. Sounds like growing pains regarding a new language feature.
>
>Try this as a workaround:
>
>        using std::string;
>        class xyz : public string { ... };
>
>The difference is that std::string is now placed in the current scope 
>as "string", which might collide with other names in the program.
>Ideally, you will abandon "string" as a user identifier because it is
>the name of a standard class. Using "string" for other purposes
>will be confusing and make future maintenance more difficult.
>---
>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: <4h2mlp$s3c@nnrp1.news.primenet.com>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
References: <4h27pi$ejv@nnrp1.news.primenet.com> <4h2ajf$l69@engnews1.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
From: kj7bg@primenet.com (Bob White)
Message-ID: <4h2mlp$s3c@nnrp1.news.primenet.com>
X-Original-Date: 28 Feb 1996 15:58:01 -0700
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 29 Feb 96 06:23:53 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Re: Namespaces within class definition???
Organization: Primenet Services for the Internet
References: <4h27pi$ejv@nnrp1.news.primenet.com> <4h2ajf$l69@engnews1.Eng.Sun.COM>
X-Posted-By: ip172.boi.primenet.com
X-Newsreader: WinVN 0.99.6
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMTVHQuEDnX0m9pzZAQE8LgF/T7W4SOKtMmbFjJwQ8OlOaELuD01bu8Bc
 IkXQrHXjG9kpHjI03LY0NKCl8H5rH8xh
 =XXN9