O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.7. Static Members of an Abstract Base Class

What about the text file against which the user queries are made? There is only one instance of the text file (or if we support multiple text files, one instance of each of the several text files). The text file, then, is represented as a static member, together with several supporting static methods and an indexer:

 abstract public class Query { static private [] string ms_textfiles; const private int ms_maxFiles = 24; static protected void check_index( int ix ) {...} static public void add_file( string name ) {...} static public int MaxFiles { get{ return ms_MaxFiles; } } static public string this[ index ix ] { get{ check_index( ix ); return ms_textfiles[ix]; } set{ check_index( ix ); ms_textfiles[ix] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required