On Jul 11, 5:44 pm, James Edward Gray II <j... / grayproductions.net> wrote: > On Jul 11, 2007, at 5:40 PM, cypher... / gmail.com wrote: > > > How do you implement something like the "abstract" keyword in Java ? > > Or: Is there a technique to force a subclass to implement a special > > method ? > > One way is: > > class Parent > def abstract_method > raise NotImplementedError > end > end > > You may just want to skip this step altogether though, since an > exception toss is the default behavior. > > Welcome to the word of dynamic typing. ;) > > James Edward Gray II It's true that an exception toss is the default behavior, but it's a NoMethodError instead of a NotImplementedError and that could be an important distinction, depending. And I agree with Robert Dober that it could get you caught by method_missing one day. What gets me about NoMethodError is you get that whether there's no method at all (which follows from the name) or as a result of going against access control (calling a private or protected method). -- -yossef