15.9.3. The Derived Classes
The most interesting part of the classes derived from
Query_base is how they are represented. The
WordQuery class is most straightforward. Its job is to hold the search word.
The other classes operate on one or two operands. A
NotQuery has a single operand, and
OrQuery have two operands. In each of these classes, the operand(s) can be an object of any of the concrete classes derived from
NotQuery can be applied to a
OrQuery, or another
NotQuery. To allow this flexibility, the operands must be stored as pointers to
Query_base. That way we can bind the pointer to whichever concrete class we need.
However, rather than storing a
Query_base pointer, our classes will ...