December 2001
Intermediate to advanced
416 pages
8h 16m
English
The solution-set data member is the same for each derived-class query type: an array of integers indicating the matching lines of text. In our initial design, our Query class defines an abstract property encapsulating the solution set:
abstract public class Query
{
abstract public int [] Solution { get; }
// ...
}
Each derived class, in turn, defines the actual solution-set instance data member and provides the actual implementation of get for the Solution property—for example,
public class NotQuery : Query
{
private int [] solution_set;
virtual public int [] Solution
{
get{ return solution_set; }
}
// ...
}
Consider the following code fragment, in which parseQuery() represents a utility that transforms a ...
Read now
Unlock full access