Hi!
I have a working prototype of a game engine and right now I'm doing some refactoring. What I'm asking for is your opinion on usage of the following C++ coding patterns.
I have implemented some trivial algorithms for collision detection and they are implemented the following way:
Not shown here - class constructor is made private and using algorithms looks like Algorithm::HandleInnerCollision(...)
class Algorithm {
// Private routines
static bool is_inside(Point& p, Object& object) {
// (...)
}
public:
/**
* Handle collision where the moving object should be always
* located inside the static object
*
* @param MovingObject & mobject
* @param const StaticObject & sobject
* @return void
* @see
*/
static void HandleInnerCollision(MovingObject& mobject, const StaticObject& sobject) {
// (...)
}
So, my question is - somebody advised me to do it "the C++" way - so that all functions are wrapped in a namespace, but not in a class. Is there some good way to preserve privating if I will wrap them into a namespace as adviced?
What I want to have is a simple interface and ability to call functions as Algorithm::HandleInnerCollision(...)
while not polluting the namespace with other functions such as is_inside(...)
Of, if you can advise any alternative design pattern for such kind of logics, I would really appreciate that...