Content deleted Content added
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. |
Tags: Reverted Mobile edit Mobile web edit |
||
Line 18:
An implementation of composition over inheritance typically begins with the creation of various [[Interface (computing)#In object-oriented languages|interfaces]] representing the behaviors that the system must exhibit. Interfaces can facilitate [[Polymorphism (computer science)|polymorphic]] behavior. Classes implementing the identified interfaces are built and added to [[business ___domain]] classes as needed. Thus, system behaviors are realized without inheritance.
In fact, business ___domain classes may all be base classes without any inheritance at all. Alternative implementation of system behaviors is
accomplished by providing another class that implements the desired behavior interface. A class that contains a reference to an interface can support implementations of the interface—a choice that can be delayed until [[Runtime (program lifecycle phase)|runtime]]. ==Example==
|