4 ms·
How are structs in Rust any different than classes?
by bart_spoon 4y ago
How are structs in Rust any different than classes?
- hdhrufjdi 4y agoBehavior and data is more separated A struct only contains data, however you e.g. can define methods on it or implement traits for it No inheritance.
- bart_spoon 4y agoThey don’t only contain data though, you can define methods as you said. Yes, there is no-inheritance, but they contain data, maintain state, and allow for defined methods. 90% of the time people are talking about classes, they are talking about that.