Inheritance vs Composition

来源:互联网 发布:2016淘宝彩票是真的吗 编辑:程序博客网 时间:2024/05/21 09:29

最近在学习golang的过程中,发现golang抛弃了inheritance,仅支持composition。为了弄清楚两者的优缺点,翻阅了很多材料,发现下面两篇文章写得不错,有兴趣的tx可以读一读:

http://www.javaworld.com/article/2076814/core-java/inheritance-versus-composition--which-one-should-you-choose-.html

http://www.javaworld.com/article/2076841/core-java/designing-with-interfaces.html

0 0