Composition over inheritance: Difference between revisions

Content deleted Content added
Tag: Reverted
Undid revision 1279527427 by 73.136.253.43 (talk)
Line 14:
 
==Basics==
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]].