Beginner Rust
Q16 / 100

What is a trait in Rust?

Correct! Well done.

Incorrect.

The correct answer is B) A collection of methods that types can implement to share behavior

B

Correct Answer

A collection of methods that types can implement to share behavior

Explanation

Traits (like Java interfaces or Haskell typeclasses) define shared behavior. trait Area { fn area(&self) -> f64; } implemented by Circle, Rectangle, etc.

Progress
16/100