Crystalのsyntax紹介 "abstract class"
この記事は、 Crystal Advent Calendar 2017 の22日目を埋める記事です。
crystalには、痒いところに手が届く構文があります。
今回は abstract class
を紹介します。
abstract class
詳細はDocsにあります。
Virtual and abstract types · GitBook
crystalでは、他の言語でお馴染みの abstract class を定義できます。
abstract class A abstract def abstract_method end a = A.new # => Error: can't instantiate abstract class A class B < A def abstract_method 1 end end b = B.new # => #<B:0x1064d2ff0>
これ以上の説明はありませんが、使ってみたい方はぜひどうぞ。