指定された特性のみを混合できるクラスが必要です。
class Peter extends Human with Lawful with Evil
class Mag extends Elf with Chaotic with Neutral
Scalaでこれを行う方法はありますか?
更新:
trait Law
trait Lawful extends Law
trait LNeutral extends Law
trait Chaotic extends Law
trait Moral
trait Good extends Moral
trait Neutral extends Moral
trait Evil extends Moral
class Hero .........
class Homer extends Hero with Chaotic with Good
クラスを拡張する場合、クライアント プログラマが特定の特性 ( / /と/ / )Hero
を混在させるようにクラスを定義したいと考えています。そして、このようなクライアント コードを制限/制約する他の可能性を見つけたいと思います。Lawful
LNeutral
Chaotic
Good
Neutral
Evil
Hero