473,320 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

unnamed namespaces

Hello,

I have been reading up on unnamed namespaces in the context of hiding
classes as mentionned by the GOF Facade pattern description. I was
hoping someone could shed some light on this.
I would like the following classes where Facade has access to Alpha
and Beta which are otherwise hidden.

class Alpha
{
Beta b;
// and methods which call b methods
};

class Beta
{
Alpha a;
// and methods which use a methods
};

class Facade
{
// various manipulations of Alpha and Beta objects
};

However I would like to be able to seperate these classes into
seperate files (as in the case of say a compiler with a facade, the
subsystem classes are numerous and large and keeping this in one file
would be crazy). Is this at all feasible with unnamed namespaces as
the GOF book describes? My major problem is the organisation of the
code in headers and source files. On this front I'm totally lost!

NB: Yes I know I could always do this with private constructors and
friend classes but I would like to see a namespace version in action.

Any help would be greatly appreciated.

Many Thanks

Anthony
Jul 22 '05 #1
1 1647
"Anthony" <to**@transcendenz.co.uk> wrote in message
news:23**************************@posting.google.c om
Hello,

I have been reading up on unnamed namespaces in the context of hiding
classes as mentionned by the GOF Facade pattern description. I was
hoping someone could shed some light on this.
I would like the following classes where Facade has access to Alpha
and Beta which are otherwise hidden.

class Alpha
{
Beta b;
// and methods which call b methods
};

class Beta
{
Alpha a;
// and methods which use a methods
};

class Facade
{
// various manipulations of Alpha and Beta objects
};

However I would like to be able to seperate these classes into
seperate files (as in the case of say a compiler with a facade, the
subsystem classes are numerous and large and keeping this in one file
would be crazy). Is this at all feasible with unnamed namespaces as
the GOF book describes?

No, it is not feasible. Stroustrup TC++PL, p 177: "In particular, unnamed
namespaces in different translation units are different. As desired, there
is no way of naming a member of an unnamed namespace from another
translation unit."
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marco Jez | last post by:
What are the requirements imposed by the Standard on unnamed namespaces? I mean, is the hidden name guaranteed to be unique across multiple translation units, or only within the declaring...
3
by: Sandy | last post by:
Hi, I have two files as folllows file1.cpp #include<iostream> using namespace std; namespace { void show(); void fun() { cout<<"fun called\n"; } }
2
by: Frank Roland | last post by:
I know it is possible to use unnamed struct or unions inside of struct like in the following example: typedef struct { union { int moin; char carl; }; int bon; } dastruct;
2
by: dioscuroi | last post by:
Is there any difference between declaring in unnamed namespace and i global namespace? I can't recognize this p.s: Have a nice day ^_________ -
9
by: Ivan Mascovich | last post by:
Previous posts (and compilers) confirm that class X { friend void Y() ; } ; does not match namespace
3
by: Tomás | last post by:
I have a header file/source file combo. There's approximately five functions in the source file. Only one of the functions should be used by other translation units, so I've defined the other...
9
by: Tom Plunket | last post by:
The project I'm currently on makes heavy use of unnamed structures to represent an "object hierarchy" of a sort. E.g. struct BaseObject { int aMember; int anotherMember; // etc.
1
by: vsgdp | last post by:
I just want to clarify: Say I have a helper class that is only used in one translation file (e.g., a predicate class). I don't want the name of this class to conflict with other class names in...
3
by: CrazyJohn | last post by:
Hi guys, This is my first time posting question here, if I break any rules, please kindly point out. And I'm really glad to be a part of this community. Here is my question, Our lecturer...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.