3.9. Defining a Derived Class

In general, a derived class needs to program only those aspects of its behavior that differ from or extend the behavior of its base class. NotQuery, for example, must provide an eval() definition that implements the not semantics. It must also introduce an instance member to store the query operand it is negating, and a property to allow get and set access to the operand, if appropriate. Both the AndQuery and OrQuery classes must support left and right operands. The NameQuery member must support a string member. All must provide definition of the abstract eval() virtual method.

The derived class is considered abstract if either it introduces an abstract member or it does not provide an implementation for an inherited ...

Get C# Primer: A Practical Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.