Composition over inheritance: Difference between revisions

Content deleted Content added
Add banner {{Cleanup bare URLs}}. After at least 7 passes by @Citation bot since 20220821, this article still has 1 untagged bare URL ref
m Added cite to the rust online book (written by the rust community) stating that rust doesn't inheritance between objects, thus agreeing with what is already written in the article.
Line 234:
Composition relation is more flexible as it may be changed on runtime, while sub-typing relations are static and need recompilation in many languages.
 
Some languages, notably [[Go (programming language)|Go]]<ref>{{cite web |url=https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html |title=Less is exponentially more |last1=Pike |first1=Rob |date=2012-06-25 |accessdate=2016-10-01 }}</ref> and [[Rust (programming language)|Rust]]<ref>{{citationCite web needed|title=Characteristics of Object-Oriented Languages - The Rust Programming Language |url=https://doc.rust-lang.org/stable/book/ch17-01-what-is-oo.html#inheritance-as-a-type-system-and-as-code-sharing |access-date=December2022-10-10 2021|website=doc.rust-lang.org}}</ref>, use type composition exclusively.
 
==Drawbacks==