Null object pattern: Difference between revisions

Content deleted Content added
Bluelinking 1 books for verifiability.) #IABot (v2.1alpha3
Line 305:
In [[Duck typing|duck-typed]] languages like [[Ruby (programming language)|Ruby]], language inheritance is not necessary to provide expected behavior.
<source lang="ruby">
class Dog
def sound
"bark"
end
end
class NilAnimal
def sound(*); end
end
 
def get_animal(animal=NilAnimal.new)