如何使用Mixin来获取不断变化的数据以流过其他类以便我可以访问数据而不必关联从我的所有类/对象中的类的实例中获取它? 例 class DataMixin(object):
data = {}
def change_data(self, data=None):
"""
HERE I AM TRYING TO ASSIGN data TO THE MIXIN
我认为包含一个模块作为类中的混合“为函数添加了”类。 我不明白为什么预期这不起作用: module A
def blah
super if defined?(super)
puts "hello, world!"
end
end
class X
include A
end
class Y < X
include A
en