zdennis wrote: > Tom Allison wrote: > >> Hello, >> I'm really new to Ruby and rather new to OOP in general. I've been >> using Perl for about 7 years now and have a fairly good understanding >> of that language. I've never really entertained Python to any serious >> degree beyond 'Hello World'. Now you know my background. >> >> I tried to do the following: >> >> 13.lcd 3 >> >> and it failed in the irb. >> >> Why? >> >> My thinking is that 13 is a Fixnum class and Fixnum inherits Integer. >> Integer has a method 'lcd' that returns the least common denominator. >> Since Fixnum < Integer then all the methods of Integer should be >> available to all the child objects (Fixnum and super). And if this is >> true, then calling a method like I did (Fixnum#lcd) implies an >> inheritance search to find that class. >> >> But my thinking seems to not reflect Ruby very well. >> >> Can someone please tell me what I did wrong in the code and also in >> thought? It's little niggly bits like this that get frustrating. >> > > Hi Tom, > > There is no method named "lcd" on Integer, unless perhaps you're using > an outside library which gives you this functionality. > > irb(main):016:0> 5.respond_to? :lcd > => false > Yeah... I just caught that. lcm shoud I require integer then?