Why not inherit from List?

前端 未结 27 2239
悲哀的现实
悲哀的现实 2020-11-21 05:39

When planning out my programs, I often start with a chain of thought like so:

A football team is just a list of football players. Therefore, I should

27条回答
  •  半阙折子戏
    2020-11-21 06:13

    Does allowing people to say

    myTeam.subList(3, 5);
    

    make any sense at all? If not then it shouldn't be a List.

提交回复
热议问题