0 votes
in Design Patterns by

Q. What is Null Object pattern?

1 Answer

0 votes
by

Ans In Null Object pattern, a null object replaces check of NULL object instance. Instead of putting if check for a null value, Null Object reflects a do nothing relationship. Such Null object can also be used to provide default behaviour in case data is not available.

In Null Object pattern, we create an abstract class specifying various operations to be done, concrete classes extending this class and a null object class providing do nothing implementation of this class and will be used seamlessly where we need to check null value.

image

Related questions

0 votes
asked Jul 24, 2023 in Design Patterns by SakshiSharma
0 votes
asked Jul 24, 2023 in Design Patterns by SakshiSharma
...