Ruby the different between class and module

lhy20062008 · March 26, 2014 · 1822 hits

class: 1、可以被实例化 2、用于创建对象 3、父类 module 4、成员包括:方法,常量,变量 5、方法包括:实例方法,类方法 6、可以被继承 7、不能 extend

module: 1、不能实例化 2、用于提供可重用方法,提供命名空间 3、父类 object 4、成员包括:方法,常量,类 5、方法包括:实例方法,module 方法 6、不能被继承,只能通过 include 被类和 module 引用 7、可以 extend

No Reply at the moment.
You need to Sign in before reply, if you don't have an account, please Sign up first.