I still dont think I am fully clear on the Class class role.
For example:
ruby-1.8.7-p330 :010 class Class
ruby-1.8.7-p330 :011? def is_a?
ruby-1.8.7-p330 :012? puts 'a'
ruby-1.8.7-p330 :013? end
ruby-1.8.7-p330 :014? end
= nil
ruby-1.8.7-p330 :015 A.is_a?
a
= nil
ruby-1.8.7-p330
On May 17, 7:43 pm, John Merlino li...@ruby-forum.com wrote:
I still dont think I am fully clear on the Class class role.
For example:
ruby-1.8.7-p330 :010 class Class
ruby-1.8.7-p330 :011? def is_a?
ruby-1.8.7-p330 :012? puts 'a'
ruby-1.8.7-p330 :013? end
ruby-1.8.7-p330
but instances of Object aren't i.e. Object.kind_of? Class is the wrong
test - Object.new.kind_of?(Class) (or in your specific example,
Peach.new.kind_of?(Class)) is the relevant one.
Fred
Thanks for response
--
Posted via http://www.ruby-forum.com/.
--
You received this message because
On May 13, 10:43 pm, John Merlino li...@ruby-forum.com wrote:
If a class is an object and an object is a class:
ruby-1.8.7-p330 :039 Class.kind_of? Object
= true
ruby-1.8.7-p330 :040 Object.kind_of? Class
= true
Wrong - not all objects are classes. Object is an instance of Class,
4 matches
Mail list logo