Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| note:wed_jun_25_2025 [2025/06/25 06:12] – created root1 | note:wed_jun_25_2025 [2025/06/25 14:36] (current) – lingao | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Typescript Cookbook ====== | ====== Typescript Cookbook ====== | ||
| + | Bookmark: ch. 2.4 | ||
| + | |||
| + | ====== Visitor Pattern ====== | ||
| + | |||
| + | To perform an operation on a pastry, we call its accept() | ||
| + | |||
| + | That’s the heart of the trick right there. It lets us use polymorphic dispatch on the pastry classes to select the appropriate method on the visitor class. In the table, each pastry class is a row, but if you look at all of the methods for a single visitor, they form a column. | ||