Hi all,
A design question is with us tonight, I would like to have your opinion.
Imagine a class Vector2,Vector3,Vector4, all of them has a global function to compute the dot product :
VectorN VectorDot( const VectorN& A, const VectorN& B );
N is 2, 3 and 4.
What is the best design, Make it global in the namespace or static for each class ?
First option :
Namespace::VectorDot( a, b );
Second option :
Namespace::Vector2::Dot( a, b );
Same for math function (abs,clamp,sqrt...), global or static in a Math class ?
I was a big user of global function and I have changed to static into a class recently, it's just a design question but it's nice to have differents opinion with experience of each.I have changed because the class can be seen like a scope.
Thanks