When to use template vs inheritance

后端 未结 5 1056
自闭症患者
自闭症患者 2020-12-07 12:57

I\'ve been looking around for this one, and the common response to this seems to be along the lines of \"they are unrelated, and one can\'t be substituted for the other\". B

5条回答
  •  悲哀的现实
    2020-12-07 13:09

    use a template in a base (or composition) when you want to retain type safety or would like to avoid virtual dispatch.

提交回复
热议问题