Null object pattern: Difference between revisions

Content deleted Content added
Removed extra comma
Tags: Mobile edit Mobile web edit
Line 173:
 
<syntaxhighlight lang="cpp">
import std;
#include <iostream>
 
class Animal {
Line 182:
};
 
class Dog : public Animal {
public:
virtual void MakeSound() const override { std::cout << println("woof!" << std::endl); }
};
 
class NullAnimal : public Animal {
public:
virtual void MakeSound() const override {}