By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

multiple namespaces

P: n/a
bob
how do you import multiple namespaces from the same header?

Apr 23 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
bo*@coolgroups.com wrote:
how do you import multiple namespaces from the same header?

How do you define import?

--
Ian Collins.
Apr 23 '06 #2

P: n/a
<bo*@coolgroups.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
how do you import multiple namespaces from the same header?


Please explain what you want. It could be as simple as:
using namespace name1;
using namespace name2;

Apr 23 '06 #3

P: n/a
bob
i'm thinking of something like this:

#include "matrixlib.h"
using namespace name1;
using namespace name2;

but i don't think that works.

Apr 23 '06 #4

P: n/a
<bo*@coolgroups.com> wrote:
i'm thinking of something like this:

#include "matrixlib.h"
using namespace name1;
using namespace name2;

but i don't think that works.


I'm not sure I know what you want. This works, does it help?

#include <iostream>
#include <cmath>

namespace abc {
//------------------------
// return the sine of an angle expressed in degrees
double sin(double th)
{
static const double pi = 3.14159;
return std::sin(th * pi / 180.);
}
} // end namespace abc

using namespace std;
//===================
int main()
{
cout << abc::sin(45.) << endl; // degrees
cout << std::sin(.98); // radians
cin.get();
}
Apr 23 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.