Discussion:
multiple namespaces
(too old to reply)
b***@coolgroups.com
2006-04-23 09:22:09 UTC
Permalink
how do you import multiple namespaces from the same header?
Ian Collins
2006-04-23 09:30:23 UTC
Permalink
Post by b***@coolgroups.com
how do you import multiple namespaces from the same header?
How do you define import?
--
Ian Collins.
Jim Langston
2006-04-23 09:30:26 UTC
Permalink
Post by b***@coolgroups.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;
b***@coolgroups.com
2006-04-23 21:03:30 UTC
Permalink
i'm thinking of something like this:

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

but i don't think that works.
osmium
2006-04-23 22:09:34 UTC
Permalink
Post by b***@coolgroups.com
#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();
}

Continue reading on narkive:
Loading...