In Ruby, what is the equivalent to an interface in C#?

后端 未结 6 1048
轮回少年
轮回少年 2021-01-01 12:31

I\'m currently trying to learn Ruby and I\'m trying to understand more about what it offers in terms of encapsulation and contracts.

In C# a contract can be defined

6条回答
  •  无人及你
    2021-01-01 12:53

    Ruby uses the concept of Modules as a stand-in (kinda) for interfaces. Design Patterns in Ruby has a lot of really great examples on the differences between the two concepts and why ruby chooses the more flexible alternative to interfaces.

    http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452

提交回复
热议问题