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 

Namespaces

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





PostPosted: Wed Sep 01, 2004 12:37 pm    Post subject: Namespaces Reply with quote



Spricht etwas dagegen, einen namespace zu verwenden, der gleichzeitig
ach eine Klasse ist? Das sähe etwa wie folgt aus:

class Foo {
};

namespace Foo {
};

Gruß Markus

--
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
Falk Tannhäuser
Guest





PostPosted: Wed Sep 01, 2004 1:09 pm    Post subject: Re: Namespaces Reply with quote



Markus Breuer wrote:

Quote:
Spricht etwas dagegen, einen namespace zu verwenden, der gleichzeitig
auch eine Klasse ist?

Ja, § 7.3.2/4 "A namespace-name or namespace-alias shall not be declared
as the name of any other entity in the same declarative region. A
namespace-name defined at global scope shall not be declared as the
name of any other entity in any global scope of the program. No diagnostic
is required for a violation of this rule by declarations in different
translation units."

Was sollte auch bei

#include <iostream>
#include <ostream>

namespace Foo
{
void bar() { std::cout << "Hello from namespacen"; }
}

class Foo
{
public:
static void bar() { std::cout << "Hello from classn"; }
};

int main() { Foo::bar(); return 0; }

gscheit's rauskommen?

MfG
Falk

--
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
Johannes Held
Guest





PostPosted: Fri Sep 03, 2004 4:53 pm    Post subject: Re: Namespaces Reply with quote



Falk Tannhäuser wrote:
Quote:
Was sollte auch bei

#include #include
namespace Foo
{
void bar() { std::cout << "Hello from namespacen"; }
}

class Foo
{
public:
static void bar() { std::cout << "Hello from classn"; }
};

int main() { Foo::bar(); return 0; }

gscheit's rauskommen?
Das einzigste was mir einfallen würde ist, dass man eine Klasse gleichen

Namens im Namensraum macht:

namespace foo
{
class foo
{
..
..
};
}

Dann weiß man zumindest eine der Klassen die drin versteckt ist..
--
Gruß, Johannes
www.hehejo.de

--
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.