On Tue, May 26, 2009 at 4:37 AM, Brian Candler <b.candler / pobox.com> wrote: > kunjaan wrote: >> What do you mean when you say"Class definitions are executable code". >> How do classes differ from other OO languages? > > Because the class is only created when the class definition code is > actually run. For example, the following code is syntactically fine: Another difference between Ruby and many other OO languages including Java, C++ and Smalltalk is that classes don't define the contents of their instances. In those languages, and many others, instance variables/fields are declared in the class (at least their existence, and for staticly typed languagues their type) and all instances have exactly the set of instance variables inherited from any superclasses plus those declared in the class itself. In Ruby each object instance has only those instance variables which have been initialized by whatever methods have been run with that object as self over the course of its lifetime. http://talklikeaduck.denhaven2.com/2008/02/08/whose-variable-is-it-anyway -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale