Trait (computer programming): Difference between revisions

Content deleted Content added
Simplify the article by breaking out the "non-technical" (for programmers) explanation into a "Rationale" section.
Excluding Methods: Faute de frappe corrigée
Tags: Mobile edit Mobile app edit Android app edit
Line 60:
=== Excluding Methods ===
 
If you exclude a method from a trait, that method becomes a 'required' method for the trait because the trait's other methods might call it. If the programming language uses [[Static dispatch|static dispatch]] ("early binding"), method names are bound areat [[Compile time|compile time]] and the trait methods might call the trait's implementation of the method and not the corresponding method provided by the class. Conversely, if the programming language uses [[Dynamic dispatch|dynamic dispatch]] ("late binding"), method names are determined at run time and the trait methods might call the class's implementation of the method and not the method provided by the trait. If a method is excluded, the programmer must take this into account.
 
==Supported languages==