Thanks for your reply,
I think I understand why we use templates here, but how am I supposed to call that function? Also, as you mentioned, using templates won't "restrict" the function to the A inherited classes right?
For instance, say that I have this template(could be the clamp you posted):
template <class T>
T Add(T a, T b) //C++ function template sample
{
return a+b;
}
As we "don't" specify T's type, it can be "everything" correct? Okay, it can't be everything because it's done in compile time and unless + operator may be used, it won't run, but you don't "restrict" it to work only for numbers, right? (int, long, float, double, etc)
Anyway, I tried your code sample, but it's raising an error when either using function<list_of_As> or function<list_of_Bs_or_Cs>
What am I doing wrong here?
About C# way, I am aware of generic keyword, even though I didn't use it yet, so I will search for it
About your clamp example, clamp algorithm only limits the area from values, correct? e.g, is X is higher than Max, then X = Max.
Why are you using it on hltypes?(isn't that some kind of array? I can't find anything on google about hltypes to be sure)
Curiosity: could you also explain what's that sng algorithm?