On Tue, Jul 10, 2012 at 4:15 AM, David Bruant <[email protected]> wrote: > > Why having both classes and traits? Both are mechanisms to enable code > reuse. > I guess I should restate my question: In which case would I use traits over > classes or classes over traits?
As I understand it traits are the code-reuse parts, and classes are little more than named records that actually bring a bunch of traits together into an actual type. I.e. you don't inherit from other classes. Traits are used to specify reusable bags of methods, and classes are used to actually provide data types on which to run those methods. -- Sebastian Sylvan _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
