Re:The Claro Programming Language
by neonsunset on Thursday February 29, 2024 @08:15AM
(#39548859)
C# interface is kind of like Rust's trait except the default passing convention by interface is similar to Box<dyn Trait> whilst passing structs implementing interface via generic arg is identical in the form of Accept<T>(T value) where T : ISomeInterface.
Arguably, today the line is somewhat blurred because interfaces can have default member implementations (which are used to extend interfaces without making it a breaking change) but generally you are correct. An abstract class and subclasses that inherit from it signifies what the type is while the interfaces a class or struct implements signify what the type does.
Arguably, today the line is somewhat blurred because interfaces can have default member implementations (which are used to extend interfaces without making it a breaking change) but generally you are correct. An abstract class and subclasses that inherit from it signifies what the type is while the interfaces a class or struct implements signify what the type does.