Content deleted Content added
→Inheritance: add sub-sections |
→Absence: fix quote, "idiomatic" not in source |
||
Line 130:
Some languages like [[Go (programming language)|Go]] do not support inheritance at all. Go states that it is object-oriented,<ref>{{Cite web |url=https://golang.org/doc/faq#Is_Go_an_object-oriented_language |title=Is Go an object-oriented language? |access-date=April 13, 2019 |quote=Although Go has types and methods and allows an object-oriented style of programming, there is no type hierarchy.}}</ref> and Bjarne Stroustrup, author of C++, has stated that it is possible to do OOP without inheritance.<ref>{{cite conference |last1=Stroustrup |first1=Bjarne |title=Object-Oriented Programming without Inheritance (Invited Talk) |date=2015 |doi=10.4230/LIPIcs.ECOOP.2015.1|url=https://www.youtube.com/watch?v=xcpSLRpOMJM|conference=29th European Conference on Object-Oriented Programming (ECOOP 2015)|at=1:34}}</ref> The doctrine of [[composition over inheritance]] advocates implementing has-a relationships using composition instead of inheritance. For example, instead of inheriting from class Person, class Employee could give each Employee object an internal Person object, which it then has the opportunity to hide from external code even if class Person has many public attributes or methods. [[Delegation (object-oriented programming)|Delegation]] is another language feature that can be used as an alternative to inheritance.
[[Rob Pike]]
[[Robert C. Martin|Bob Martin]] states that because they are software, related classes do not necessarily share the relationships of the things they represent.<ref>{{cite web | url=https://www.youtube.com/watch?v=zHiWqnTWsn4 | title=Uncle Bob SOLID principles | website=[[YouTube]] }}</ref>
|