Advertisement
AllWeather

Untitled

Apr 12th, 2021
968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. class IAction {
  4. public:
  5.     virtual void Act() = 0;
  6. };
  7.  
  8. class PrintMessage : public IAction {
  9. public:
  10.     void Act() { std::cout << "I'm Acting!";};
  11. };
  12.  
  13. struct Node {
  14.     Node* next = nullptr;
  15.     Node* prev = nullptr;
  16.     IAction* data = nullptr;
  17. };
  18.  
  19. int main(int argc, char* argv) {
  20.     Node MyNode = Node();
  21.     MyNode.data = new PrintMessage();
  22.     MyNode.data->Act();
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement