gpt4 book ai didi

c++ - 适当的继承

转载 作者:搜寻专家 更新时间:2023-10-31 00:04:52 26 4
gpt4 key购买 nike

什么是适当的继承?

最佳答案

This thread给出了一个很好的总结:

  • Proper inheritance occurs when the derived class "IS A" specialized type of the base class. Example Cat IS A Animal.

  • Improper inheritance occurs when a class is inherited from merely for code reuse without having any other relationship. Example Cat Inherits from Engine. A Cat is not an engine however both an engine and a cat purr.

关于c++ - 适当的继承,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3389318/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com