Hacker News new | past | comments | ask | show | jobs | submit login

Rust doesn't do single inheritance, basically.

If they had fields, what would you do when you implemented two of them on a struct? It also muddles up the ability to tack on traits in later crates.

Traits aren't supposed to be used the way you do single inheritance. Rust prefers composition over inheritance, so you combine structs and enums to get what you want there.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: