Why use tuples instead of objects?

后端 未结 10 1863
别那么骄傲
别那么骄傲 2020-12-24 05:29

The codebase where I work has an object called Pair where A and B are the types of the first and second values in the Pair. I find this object to be offensive, because it g

10条回答
  •  时光说笑
    2020-12-24 05:51

    The obvious example is a coordinate pair (or triple). The labels are irrelevant; using X and Y (and Z) is just a convention. Making them uniform makes it clear that they can be treated in the same way.

提交回复
热议问题