{"url":"https://miz-tech.hatenadiary.org/entry/20091028/1256665571","height":"190","title":"Ruby\u306e\u7d99\u627f","published":"2009-10-28 02:46:11","image_url":null,"provider_url":"https://hatena.blog","author_name":"miz_tech","provider_name":"Hatena Blog","description":"\u30b9\u30fc\u30d1\u30fc\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u7d99\u627f\u3059\u308b\u969b\u306e\u5f15\u6570\u3067\u6df7\u4e71\u3057\u305f\u306e\u3067\u3001\u81ea\u5206\u306a\u308a\u306b\u307e\u3068\u3081\u3066\u307f\u305f\u3002 class Sup attr_reader :x def initialize #\u5f15\u304d\u7d99\u304c\u308c\u306a\u3044 @x=4 end def initialize(x) @x=x-3 end end class Sub < Sup attr_reader :y def initialize(y) super @y=y end end obj=Sub.new(6) p obj.x #=> 3 p obj.y #=> 6 \u5f15\u6570\u306a\u3057\u306einitialize\u3092\u547c\u3093\u3060\u3064\u3082\u308a\u3060\u3063\u305f\u306e\u3060\u304c\u3001\u3069\u3046\u3084\u3089super\u306f\u5f15\u6570\u3092\u305d\u306e\u307e\u307e\u6e21\u3057\u3066\u3044\u308b\u307f\u305f\u3044\u3060\u3002\u2026","categories":["ruby"],"blog_url":"https://miz-tech.hatenadiary.org/","author_url":"https://blog.hatena.ne.jp/miz_tech/","version":"1.0","type":"rich","blog_title":"/Users/mizchi/workplace/","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmiz-tech.hatenadiary.org%2Fentry%2F20091028%2F1256665571\" title=\"Ruby\u306e\u7d99\u627f - /Users/mizchi/workplace/\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>"}