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

namespace/static style issue

P: n/a
Does anyone have any reasons for preferring one of these approaches to the
other?
namespace Maths
{
const float g_magicNumber = 1.234f;

float Sqrt(float f);
}

OR
class Maths
{
static const float g_magicNumber; // (with separate initialiser)

static float Sqrt(float f);
};
cheers,
g.a.

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Glen Able" <Gl*******@gmail.com> wrote in message
news:cu*******************@news.demon.co.uk...
Does anyone have any reasons for preferring one of these approaches to the
other?

namespace Maths
{
const float g_magicNumber = 1.234f;

float Sqrt(float f);
}

OR
class Maths
{
static const float g_magicNumber; // (with separate initialiser)

static float Sqrt(float f);
};


Sure, first of all the 2nd option will be hard to use
because a 'public:' is missing ;)

The namespace is also a better option because you can
write 'using namespace Maths;' when desirable.
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.