Use inheritance to reduce code duplication.