Content deleted Content added
Reverting edit(s) by 172.59.120.127 (talk) to rev. 1256782476 by Jarble: Non-constructive edit (UV 0.1.6) |
Jerryobject (talk | contribs) →Inheritance: Small WP:COPYEDIT WP:EoS WP:TERSE: cut needless words repeat. WP:LINKs: update-standardize, add. |
||
Line 145:
===Inheritance===
OOP languages are diverse, but typically
==== Class-based ====
Line 167:
==== Absence ====
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 |author1-link=Bjarne Stroustrup |title=Object-Oriented Programming without Inheritance (Invited Talk) |date=2015 |doi=10.4230/LIPIcs.ECOOP.2015.1 |doi-access=free |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]] has criticized the OO mindset for preferring a multilevel type hierarchy with layered abstractions to a three-line [[lookup table]].<ref>{{cite web |url=http://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb |title=A few years ago I saw this page |last1=Pike |first1=Rob |access-date=1 October 2016 |date=14 November 2012|archive-url=https://web.archive.org/web/20180814173134/http://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb |archive-date=14 August 2018
[[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 |
===Dynamic dispatch/message passing===
|