From: Ned Konz Date: 2001-09-05T04:23:32+09:00 Subject: [ruby-talk:20886] Re: newbie question On Tuesday 04 September 2001 12:15 pm, Pat Eyler wrote: > On 05 Sep 2001 03:48:48 +0900, Ned Konz wrote: > > On Tuesday 04 September 2001 11:18 am, Pat Eyler wrote: > > > I never did translate: > > > > > > public class Movie { > > > public static final int CHILDREN = 2; > > > public static final int REGULAR = 0; > > > public static final int NEW_RELEASE = 1; > > > } > > > > > > into ruby, instead I just used the magic numbers 0, 1, and 2 as needed > > > in methods of other classes and ignored it figuring I would have a > > > blinding flash of the obvious and go back and fix things. As can be > > > expected, the blinding flash never came. > > > > > > Would someone mind enlightening me? > > > > class Movie > > CHILDREN = 2 > > REGULAR = 0 > > NEW_RELEASE = 1 > > # ... > > end > > I'd tried this, but it fails when I try to use the values outside a > Movie (see the class Price hierarchy) in the code below. This probably > means that I'm doing something else wrong... Well, they're not globals, so you'd have to refer to them by fully-qualified name: Movie::CHILDREN -- Ned Konz currently: Stanwood, WA email: ned@bike-nomad.com homepage: http://bike-nomad.com