tailieunhanh - Extendelly Hierarchy Box

Extending an Inheritance Hierarchy In the following exercise, you will familiarize yourself with a small hierarchy of interfaces and classes that together implement a very simple framework. | Extending an Inheritance Hierarchy In the following exercise you will familiarize yourself with a small hierarchy of interfaces and classes that together implement a very simple framework. The framework is a Microsoft Windows application that simulates reading a C source file and classifying its contents into tokens identifiers keywords operators and so on . The framework provides a mechanism for visiting each token in turn performing various tasks. For example A displaying visitor class that displays the source file in a rich text box. A printing visitor class that converts tabs to spaces and aligns braces correctly. A spelling visitor class that checks the spelling of each identifier. A guideline visitor class that checks that the public identifiers start with a capital letter and that interfaces start with a capital I. A complexity visitor class that monitors the depth of the brace nesting in the code. A counting visitor class that counts the number of lines in each method the number of members in each class and the number of lines in each source file. Understand the inheritance hierarchy and its purpose 1. Start Microsoft Visual Studio 2005. 2. Open the Tokenizer project located in the Microsoft Press Visual CSharp Step by Step Chapter 12 Tokenizer folder in your My Documents folder. 3. Display the source file in the Code and Text Editor window. The SourceFile class contains a private array field called tokens private IVisitableToken tokens new KeywordToken using new WhitespaceToken new IdentifierToken System new PunctuatorToken . The tokens array contains a sequence of objects that all implement the IVisitableToken interface. Together these tokens simulate the tokens of a simple hello world source file. A complete version of this project would parse a named source file and construct these tokens dynamically. The SourceFile class also contains a public method called Accept. The Accept method has a single parameter of type ITokenVisitor. The body .

TÀI LIỆU LIÊN QUAN
10    158    1
6    184    1
7    162    1
5    157    1
6    160    1
6    152    1
6    150    1
6    206    1
7    154    1