[ I S]上午班 老師有東西漏講了

看板b96902HW作者 (祈)時間16年前 (2008/05/13 18:21), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
Mixin In object-oriented programming languages, a mixin is a class that provides a certain functionality to be inherited by a subclass, but is not meant to stand alone. Inheriting from a mixin is not a form of specialization but is rather a means to collect functionality. A class may inherit most or all of its functionality by inheriting from one or more mixins through multiple inheritance. Mixins first appeared in the Symbolics' object-oriented Flavors system, which was an approach to object-orientation used in Lisp Machine Lisp. The name was inspired by Steve's Ice Cream Parlor in Somerville, Massachusetts: The ice cream shop owner offered a basic flavor of ice cream (vanilla, chocolate, etc.) and blended in a combination of extra items (nuts, cookies, fudge, etc.) and called the item a "Mix-In", his own trademarked term at the time. Mixins encourage code reuse and avoid well-known pathologies associated with multiple inheritance. However, mixins introduce their own set of compromises. A mixin can also be viewed as an interface with implemented methods. When a class includes a mixin, the class implements the interface and includes, not inherits, all the mixin's attributes and methods. They become part of the class during compilation. Interestingly enough mixins don't need to implement an interface. The advantage of implementing an interface is that instances of the class may be passed as parameters to methods requiring that interface. A mixin can defer definition and binding of methods until runtime, though attributes and instantiation parameters are still defined at compile time. This differs from the most widely-used approach, which originated in the programming language Simula, of defining all attributes, methods and initialization at compile time. http://en.wikipedia.org/wiki/Mixin ps 老師要我告訴上午班同學"Mixin"沒講到 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.112.11.220

05/13 18:49, , 1F
這會不會太用力了...
05/13 18:49, 1F
文章代碼(AID): #18AMkYSO (b96902HW)