Null object pattern: Difference between revisions

Content deleted Content added
External links: non-standard spelling
mNo edit summary
Line 362:
<syntaxhighlight lang="java">
public interface Animal {
void makeSound() ;
}
 
Line 373:
public class NullAnimal implements Animal {
public void makeSound() {
// silence...
}
}
Line 417:
function makeAnimalFromAnimalType(string $animalType): Animal
{
switch ($animalType) {
case 'dog':
return new Dog();