3.2. Supporting a Polymorphic Query Language

In the remainder of this chapter we implement a query language class hierarchy to introduce the C# language constructs and programming idioms that support object-oriented programming. What is a query language? It is part of a general text query application that allows users to search a text file for the occurrence of one or more words. For example, here is the text file against which our queries are directed:

Alice Emma has long flowing red hair. Her Daddy says

when the wind blows through her hair, it looks almost alive,

like a fiery bird in flight. A beautiful fiery bird, he tells her,

magical but untamed. "Daddy, shush, there is no such creature,"

she tells him, at the same time wanting him to tell ...

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.