Skip to main content
trait

trait

11 8.3
A piece of code that gives methods to different classes without using class inheritance
  • noun
  • /treɪt/
  • Specialized
translation icon : trait
  • Using a trait can help developers add specific methods to multiple classes easily and efficiently.
  • trait anxiety
  • trait dominance
  • hereditary traits

Examples

  • The most frequently described positive trait was that their child was sweet and had a kind or gentle spirit.

    Academic text (2015)
  • We asked respondents to rate the degree to which each trait was characteristic of their child.

    Academic text (2015)
  • Subject beta has gained a number of traits that we anticipated going into the project.

  • Whatever gene it is that carries the trait for my father's and my eyes must be a dominant one.

    Fiction book (1991)
  • UCPs must conduct research to investigate students' problems, needs, and traits, as well as the effectiveness of various services.

    Academic text (2015)
  • The resistance trait might have to be bred into each wheat cultivar separately.

    Academic text (1995)
  • African American children manifest a variety of personality traits, temperaments, attitudes, and values.

    Academic text (1992)
  • In programming, a trait can be mixed into classes to enhance their functionality without using traditional inheritance.

  • The trait of being able to share common behavior is vital for building reusable code in software development.

Antonyms

inheritance
  • Specialized
7 4.9

The way children get physical traits from their parents

Compounds

autistic trait
  • Specialized
1 7.7

A behavior often seen in people with autism, for example repeating actions or finding talking to people hard

1 3.7

A quality that makes a person or thing stand out

How Reusable

library
  • Specialized
77 4.9
module
101 3.7
trait
  • Specialized
11 8.3
function
  • Specialized
343 4.9
snippet
36 4.8

Surface Forms

trait singular
traits plural

Etymology

Trait in programming keeps the same idea of a 'feature' from the root tract meaning 'to draw' or 'to pull' and refers to a small set of methods you add to a class to give it certain behavior. So a programming trait is a clear part or feature that changes how a class works.