Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This file is a "Hello, world!" in C++ language by GCC for wandbox.
- #include <iostream>
- #include <cstdlib>
- #include <thread>
- #include <vector>
- class FooBase
- {
- virtual void OnStateChange() = 0;
- };
- class FooBaseImpl : public FooBase {
- void OnstateChange() override {
- // stuff in static stateChange();
- }
- };
- class FooImpl : public FooBase
- {
- void OnStateChange() { .. }
- };
- class Bar
- {
- Bar() {
- static FooBaseImpl impl
- foovec.push_back(&impl);
- }
- void test() {
- Foo::stateChange();
- for(f : foovec) f->OnStateChange();
- }
- vector<FooBase*> foovec;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement