class Place
def rent
puts "oh, don't call me"
end
end
class House < Place
def rent
puts "make rent"
end
end
class HouseAgency < Place
attr :real_place
def rent
puts "rise 100% in price"
@real_place ||= House.new
@real_place.rent
end
end
# console
house_agency = HouseAgency.new
house_agency.rent
Proxy pattern
最新推荐文章于 2024-12-05 19:46:44 发布

1321

被折叠的 条评论
为什么被折叠?



