Why can't a class be an instance of class Class and also inherit from
class Class in ruby?


Let's say I defined a singleton method on Class:

1.9.3p0 :032 > class Class
1.9.3p0 :033?>   def Class.class_singleton
1.9.3p0 :034?>     puts 'class singleton'
1.9.3p0 :035?>     end
1.9.3p0 :036?>   end

And I want to create a class that can inherit that singleton method:

1.9.3p0 :039 > class Q < Class
1.9.3p0 :040?>   end
TypeError: can't make subclass of Class

How then could it be possible to access that singleton method without
directly calling it on Class? And why is inheriting from Class not
allowed?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to