Created
February 3, 2020 23:07
-
-
Save lakinwecker/a94fc4a2a6c37c94363be482ec39df1b to your computer and use it in GitHub Desktop.
This file contains 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
#include <iostream> | |
struct Cell {}; | |
struct DGGS { | |
virtual void children(Cell *c) = 0; | |
virtual Cell *child() = 0; | |
}; | |
struct QuadCell: public Cell { | |
}; | |
struct DGGS1 : public DGGS { | |
void children(QuadCell *c) { | |
std::cout << "Y.QuadCell!" << std::endl; | |
} | |
Cell *child() override { | |
return QuadCell{}; | |
} | |
}; | |
int main() { | |
DGGS *d = new DGGS1(); | |
Cell *c = d->child(); | |
d->children(c); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment