Home > Back-end >  If you need to write a calculated two want to the same type of object function of the "distance
If you need to write a calculated two want to the same type of object function of the "distance

Time:09-23

Who turn to for help: if you need to write a calculated two want to objects of the same type of "distance" letter
Number, the two objects can have dozens of types, what did you do?

CodePudding user response:

Each type defines its own distance calculation method, then write a template function, thus to unify the ah,

CodePudding user response:

reference 1/f, little _ _ _ Yang response:
each type defines its own distance calculation method, and then write a template function, thus to unify the ah,

Thank you very much! Hee hee! Thank you!

CodePudding user response:

First determine whether the calculation of the distance and the types, related, easier to walk without the reshipment or function, or abstract inheritance, has nothing to do with it is simple, using the template function, for instance the sort is a template function

CodePudding user response:

reference Italink reply: 3/f
first clear whether the calculation of the distance and the types, related, easier to walk without the reshipment or function, or abstract inheritance, has nothing to do with it is simple, using the template function, for example the sort is a template function

Thank you very much! Thank you! hippies

CodePudding user response:

Inside the template, can see the modern c + + design, policy,
  • Related