X-Git-Url: http://nitlanguage.org diff --git a/doc/developpez/poo/listings/type1_c.nit b/doc/developpez/poo/listings/type1_c.nit new file mode 100644 index 0000000..135b7b9 --- /dev/null +++ b/doc/developpez/poo/listings/type1_c.nit @@ -0,0 +1,18 @@ +abstract class Aliment end + +class Herbe special Aliment end + +class Animal + type REGIME: Aliment + + fun manger(x: REGIME) do print "Je mange" +end + +class Vache + special Animal + + redef type REGIME: Herbe +end + +var vache = new Vache +vache.manger(new Herbe)