| re: Class with all static members --> Is namespace() the right choice?
* qazmlp:[color=blue]
> I just noticed the following class design in a module.
> class testClass
> {
> public:
> static long utilFunc1() ;
> static long utilFunc2() ;
> static long utilFunc3() ;
> private:
> testClass(){};
> ~testClass(){};
>
> static someClass1* someObj1Ptr ;
> static someClass2* someObj2Ptr ;
> static someClass3* someObj3Ptr ;
> };
>
> The class design looks ugly for me. The implementation also gives the
> feeling that, this class is just a placeholder for the utility
> functions.
> In that case, could I suggest to use namespace instead of a class?
> The only reason why I hesitate to suggest that is, the class also
> contains some
> members. Can still the namespace be the correct choice here?
>
> Kindly clarify![/color]
It seems the class could reasonably be split into two classes, one
with the non-static members and one with the static utility functions.
A class with only static members _can_ be useful e.g. as a template
argument.
But from what you write that seems unlikely.
The alternatives are (1) placing those functions at namespace
scope, or (2) using a singleton, or (3) re-design, who knows
what might pop out?
There is not enough information to recommend any specific design.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? |