Описание тега traits

In computer programming, a trait is a collection of methods, used as a "simple conceptual model for structuring object oriented programs"

In computer programming, a trait is a collection of methods, used as a "simple conceptual model for structuring object oriented programs".

Traits have the following properties

  • Provides a set of methods that implement behaviour.
  • Requires a set of methods that parameterize the provided behaviour.
  • Does not specify any state variables.
  • Never directly accesses state variables.

Can be composed

  • Trait composition is symmetric and conflicting methods are excluded from the composition.
  • Can be nested, but the nesting has no semantics for classes.