Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6349103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:33:00+00:00 2026-05-24T21:33:00+00:00

I seem to recall seeing notes somewhere on a way to combine multiple namespaces

  • 0

I seem to recall seeing notes somewhere on a way to combine multiple namespaces into one.

Now, looking for said notes I am not finding them — even searching using search terms combing, grouping, merging and wrapping I’m not coming up with anything. Maybe I misunderstood what I saw before. I don’t have a specific application for this, it’s just a curiosity and it’s a bit contrived.

But, starting with two name spaces…

namespace a {int func() {return 1;}}
namespace b {int func() {return 2;}}

I was looking for syntax to either simply wrap them in another name — after the fact —
(yes, I know I can rewrite it in a nested way) or merge them into one new space. But, I did find that I if I add to one of the namespaces that much works.

namespace c {namespace a{ int func2() {return 3;}} }


int main(int argc, char **argv)
{
    int a = a::func();          // normal case
    int c = c::a::func2();      // wrapped and added to

    //int c = c::func2();       // doesn't work
    //int d = a::func2();       // doesn't work
}

The question are:

1) is there syntax that just combines the two spaces into one new one?

2) is there a syntax to wrap the spaces without adding more to the subspaces?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:33:01+00:00Added an answer on May 24, 2026 at 9:33 pm

    You can do this:

    namespace c
    {
        using namespace a;
        using namespace b;
    }
    

    But if a and b have elements with the same names, you won’t be able to use them from namespace c.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to recall (though can't find any reference now) to one being able
I don't remember whether I was dreaming or not but I seem to recall
I seem to recall reading about a way to 'reduce' the size of template
I seem to recall that it is not safe to trust the value of
I seem to recall reading somewhere that the cost of a virtual call in
I seem to recall that there is an HTML tag that escapes absolutely everything
I seem to recall something about avoiding the Immediate If operator ( ?: )
I seem right now to be embroiled in a debate with another programmer on
I seem to recall hearing at some point (I believe it was MIX09) that
I could very will be imagining things, but I seem to recall in Java

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.