hemant
1/11/2007 5:35:00 AM
On Thu, 2007-01-11 at 13:42 +0900, Paul Smith wrote:
> Thanks Hemant. However, as I mentioned in my last reply, it is not clear
> to me what triggers the execution of a statement such as "sayfoo
> :rubyrocks" in your example. When the class is loaded, when an instance
> is created, ???
>
> Thanks.
On a broader perspective, we can say when the class is loaded, when you
define a class like this in your code:
class Baz < Foobar
sayfoo :rubyrocks
end
An object called Baz starts to exist in current Runtime, which is an
instance of class Class.
So, when method sayfoo gets invoked when object Baz is created or in
other words, we can say when class is loaded.