{"categories":["kotlin"],"width":"100%","image_url":null,"type":"rich","version":"1.0","provider_name":"Hatena Blog","title":"Kotlin sealed class \u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u306e\u6319\u52d5","author_name":"jumperson","url":"https://jumperson.hatenablog.com/entry/2016/08/09/090842","blog_title":"Programmer_Mixin_Conductor's Blog ","provider_url":"https://hatena.blog","description":"sealed class \u3092 when \u3067\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u3057\u305f\u969b\u306b\u3001\u60f3\u5b9a\u5916\u306e\u6319\u52d5\u3092\u3057\u3066\u3044\u305f\u306e\u3067\u3044\u308d\u3044\u308d\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u7db2\u7f85\u30c1\u30a7\u30c3\u30af \u7db2\u7f85\u30c1\u30a7\u30c3\u30af\u304c\u52d5\u304d\u305d\u3046\u3067\u52d5\u304b\u306a\u304b\u3063\u305f\u30b1\u30fc\u30b9 \u30d3\u30eb\u30c9\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u305b\u3093\u3002 sealed class Event { class Insert: Event() class Update: Event() class Delete: Event() } fun hoge(event: Event) { when(event) { is Event.Insert -> { print(\"Insert\") } is Event.Update -> { print(\"Up\u2026","blog_url":"https://jumperson.hatenablog.com/","author_url":"https://blog.hatena.ne.jp/jumperson/","published":"2016-08-09 09:08:42","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fjumperson.hatenablog.com%2Fentry%2F2016%2F08%2F09%2F090842\" title=\"Kotlin sealed class \u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u306e\u6319\u52d5 - Programmer_Mixin_Conductor&#39;s Blog \" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190"}