Tham khảo tài liệu 'praise for c# : practical guide for programmers 2005 phần 8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 162 Chapter 7 Advanced Types Polymorphism and Accessors Exercises Exercise 7-1. Write an object-oriented version of the Unix word count wc utility see description in Exercise 6-3 . Exercise 7-2. Implement the common behavior of the ICounter interface in an abstract Counter class. Hint Only the process method that compares each character read stays abstract in order to be implemented in three concrete classes CharCounter LineCounter and WordCounter. Exercise 7-3. Extract the behavior of a counter in an ICounter interface. Hint At least four methods are needed to count process reset and get the counter value. ter 8 chap Collections and Generics The mathematical library of the FORTRAN programming language was and still is a fundamental strength of the language. Code that has been optimized and tested for decades continues to serve the needs of scientists and engineers worldwide. Newer programming languages like Java and C are also supported by extensive libraries of reusable code reducing software design in many cases to a question of finding the right class with the right behavior for the right job. This reuse of components is a practice of long standing in every engineering discipline. It is not surprising therefore that software reuse has gained much more prominence over the last two decades as designers have shied away from the risk of reinventing the wheel and embraced the security of reusing code that is more reliable more portable and more maintainable. Object-oriented technology is a perfect catalyst for software reuse based on its three fundamental characteristics of classes inheritance and polymorphism. In this chapter we examine in greater depth the Framework Class Library FCL of .NET first mentioned in Chapter 1. The FCL implements several traditional data structures such as hash tables queues and stacks that are modeled in an object-oriented way via classes and interfaces. Essentially these classes and interfaces can be thought of as collections of .