O'Reilly logo
  • LI WEI thinks this is interesting:

What does that mean if you were coding creatures? You would only have to program the common functionality once. Then, you would implement the code for the different parts specifically for each of the dog, cat, horse and human classes.

From

Cover of Learning C++ by Creating Games with UE4

Note

继承可以将自己要创建的不同对象的共性提炼成父层,然后再让有差异化的对象们继承之,好处是不用每次都重新造轮子。并且你要让他们有一些共性算法时,将他们付对象进行处理