Which is appropriate:
class xyz {
static int xyzOp1() { }
static int xyzOp2() { }
};
OR
namespace xyz {
static int xyzOp1() {}
static int xyzOp2() {}
};
Is there something specific which we can get when we define using class tag in comparision with namespace tag?
Also is there any different in memory management, which we need to worry?
Without seeing the body of these functions, I would say that namespaces are more appropriate. With namespaces, you can have
usingstatements, so that you don’t have to fully-qualify the function names when calling them.The only case in which to use classes is when the static methods have any relationship with objects of the class, e.g. when they need to access private members of instances. From your description, it seems that you won’t be creating any instances of xyz, so you shouldn’t be using classes here.
From a memory management point of view, there is no difference between these approaches.