C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

static frage

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Daniel Schüle
Guest





PostPosted: Thu May 20, 2004 3:51 pm    Post subject: static frage Reply with quote



Hallo NG

im globalen namespace

static class foo
{/**/}bar;

macht variable bar static
was ist eigentlich wenn

static class foo
{/**/};
foo bar; // ist bar static oder ist die obige defintion so falsch?

oder so

typedef static class foo foo_t;
foo_t bar; // ist hier bar static?

man könnte ja noch const/volatile ins Spiel bringen
die Frage bleibt die selbe, und zwar auf was bezieht sich dann der modifier
auf den typ oder auf die variable (wenn diese der Klassendefinition folgt)?

MfG

Daniel

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Horst Kraemer
Guest





PostPosted: Thu May 20, 2004 7:27 pm    Post subject: Re: static frage Reply with quote



On Thu, 20 May 2004 17:51:58 +0200, Daniel Schüle
<uval (AT) rz (DOT) uni-karlsruhe.de> wrote:

Quote:
static class foo
{/**/}bar;

Definiert eine statische Variable namens bar vom Typ class foo.

Quote:
macht variable bar static
was ist eigentlich wenn

static class foo
{/**/};
foo bar; // ist bar static oder ist die obige defintion so falsch?

Sie ist falsch, 'static' ist kein zulaessiges Attribut einer Klasse,
sondern ein Attribut einer Variablen. Damit beantworten sich auch die
uebrigen Fragen.

typedef static int sint;

geht auch nicht ;-)

--
Horst

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Rolf Magnus
Guest





PostPosted: Fri May 21, 2004 9:26 am    Post subject: Re: static frage Reply with quote



Daniel Schüle wrote:

Quote:
Hallo NG

im globalen namespace

static class foo
{/**/}bar;

macht variable bar static

Genau.

Quote:
was ist eigentlich wenn

static class foo
{/**/};
foo bar; // ist bar static oder ist die obige defintion so
falsch?

Ersteres. Nur Variablen und Funktionen können static sein, Klassen
nicht.

Quote:
oder so

typedef static class foo foo_t;
foo_t bar; // ist hier bar static?

man könnte ja noch const/volatile ins Spiel bringen
die Frage bleibt die selbe, und zwar auf was bezieht sich dann der
modifier auf den typ oder auf die variable (wenn diese der
Klassendefinition folgt)?

Immer auf die Variable, da sie auf den Typ gar nicht angewendet werden
dürfen.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Rolf Magnus
Guest





PostPosted: Fri May 21, 2004 11:32 am    Post subject: Re: static frage Reply with quote

Rolf Magnus wrote:

Quote:
was ist eigentlich wenn

static class foo
{/**/};
foo bar; // ist bar static oder ist die obige defintion so
falsch?

Ersteres.

Das ist natürlich Quatsch. Es hätte "Letzteres." heißen müssen.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.