Mi sapete spiegare la differenza tra i metodi instance_of? e kind_of?
e tra is-a e has-a?
Grazie mille!
Mi sapete spiegare la differenza tra i metodi instance_of? e kind_of?
e tra is-a e has-a?
Grazie mille!
*esempio
1.instance_of?(Fixnum)
=> true
i = 1
i.instance_of?(Numeric)
=> false
i.instance_of?(Fixnum)
=> true
i.kind_of?(Numeric)
=> true
#perchè Numeric è la superclass di Integer che è la superclass di Fixnum)
i.kinf_of?(Integer)
=> true
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs