hnOsmium0001

Untitled

Oct 9th, 2020
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This file is a "Hello, world!" in C++ language by GCC for wandbox.
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <thread>
  5. #include <vector>
  6. class FooBase
  7. {
  8. virtual void OnStateChange() = 0;
  9. };
  10.  
  11. class FooBaseImpl : public FooBase {
  12. void OnstateChange() override {
  13. // stuff in static stateChange();
  14. }
  15. };
  16.  
  17. class FooImpl : public FooBase
  18. {
  19. void OnStateChange() { .. }
  20. };
  21.  
  22. class Bar
  23. {
  24. Bar() {
  25. static FooBaseImpl impl
  26. foovec.push_back(&impl);
  27. }
  28.  
  29. void test() {
  30. Foo::stateChange();
  31. for(f : foovec) f->OnStateChange();
  32. }
  33. vector<FooBase*> foovec;
  34. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×