|
|
|
|
|
by nicoburns
2294 days ago
|
|
I guess it's kind close to a C++ class. It's pretty different to a class in a language like Java, because all classes in Java are heap allocated and behind references. Enums are are the better example of non-class types. For example, you can have: enum StringOrInt {
String(String),
Int(u32),
}
And you can go ahead and implement methods on that type. Classes have "AND-state", not "OR-state". But a Type in general can have either kind of state. |
|