Ruby - Inheritance
Identify the error in this Ruby code snippet:
class Animal; end class Dog < Animal; end obj = Dog.new puts obj.is_a(Animal)
class Animal; end class Dog < Animal; end obj = Dog.new puts obj.is_a(Animal)
is_a? requires a question mark at the end.is_a without the question mark, causing a NoMethodError.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions