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 

"Right" use of namespaces

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
lionheart
Guest





PostPosted: Mon Aug 14, 2006 9:10 am    Post subject: "Right" use of namespaces Reply with quote



Hi,
I am currently trying to group my classes using namespaces. But since
these groups are not really independend I end up to have a lot of
forward declarations.

My first approache was to enclose all class definitions and forward
declarations in the corresponding headers directly. Which turned out to
make it difficult to read the header, and created a lot of overhead.

Therefore at the moment I am using a headerfile dedicated to forward
delcarations which are enclosed in the correct namespace. Is this a
common strategie? What are the up- and downsides from your perspective?
What are the alternatives?

In the headerfiles I am not using the "using-directive" to import
classnames in the namespace, because I don't want to make them
accessible through a second namespace. Same reason we I don't create a
"shortcut-namespace" (e.g. namespace abc = ada::basic::cobol). But
since I am using the namespace hierachie directly, first there is a lot
of overhead in writting and second if I change the namespaces I have to
change it in every single file. Is there an alterative? If the
using-directive would make the namespace/class imported visible from
outside it would be my perfect choice.

In the .cpp files I take advantage of the the using-directive a lot.
Since all .cpp-files are closed entities it should be fine to do so,
right?

Thanks for your help,
Thomas Kowalski
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) 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.