Last active
December 19, 2015 16:19
-
-
Save plonk/5983259 to your computer and use it in GitHub Desktop.
snippet from Design Patterns (pp.71-72)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void SpellingChecker::Check (Glyph* glyph) { | |
| Character* c; | |
| Row* r; | |
| Image* i; | |
| if (c = dynamic_cast<Character*>(glyph)) { | |
| // analyze the character | |
| } else if (r = dynamic_cast<Row*>(glyph)) { | |
| // prepare to analyze r's children | |
| } else if (i = dynamic_cast<Image*>(glyph)) { | |
| // do nothing | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment