Skip to content

Instantly share code, notes, and snippets.

@lakinwecker
Created February 3, 2020 23:07
Show Gist options
  • Save lakinwecker/a94fc4a2a6c37c94363be482ec39df1b to your computer and use it in GitHub Desktop.
Save lakinwecker/a94fc4a2a6c37c94363be482ec39df1b to your computer and use it in GitHub Desktop.
#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