Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| note:wed_jun_25_2025 [2025/06/25 09:56] – root1 | note:wed_jun_25_2025 [2025/06/25 14:36] (current) – lingao | ||
|---|---|---|---|
| Line 4: | Line 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. | ||