Putting It Together: An Extensible Calculator

To recap everything you’ve learned about delegates so far, we create a calculator that can be extended by plugging in new operators. Although we don’t focus on the UI aspect, take a look at Figure 17.13 to see what I have in mind.

Image

FIGURE 17.13 An extensible calculator.

Besides typical arithmetic operations like add, subtract, multiply, divide, and modulo, four additional programmable function keys are provided. How this programming is done from a user’s point of view is something you can dream about, but what’s more interesting is how to create a generic calculator engine into which custom operations ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.