From: Jeremy Bopp Date: 2012-02-04T10:14:25+09:00 Subject: Re: Inheritance in other notation luk malcik wrote: >Hi everybody! I've got a problem with ingeritance. If there is a >notation like 'class Square', we can write class Rectangle like 'class >Rectangle >Square = Struct.new(:x,:y,:a) do > include Domieszka > def pole > p = a**2 > end > def obwod > o = 4*a > end > def pole=(a) > self.a = a > end > def obwod=(a) > self.a = a > end >end > > >Rectangle include Domieszka > def pole > p = a*b > end >end The constant Square is a class effectively equivalent to conventionally created classes, so you don't have to do anything special to make Rectangle descend from it. Just do it as you originally expected: class Rectangle < Square ... end -Jeremy