Advertisement
AmbushedRaccoon

OOP task

Jul 18th, 2025
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.61 KB | None | 0 0
  1. struct MutationConfig
  2. {
  3. };
  4.  
  5. struct MutationResult
  6. {
  7.     bool success;
  8.     bool flag;
  9.     std::string message;
  10. };
  11.  
  12. class BaseMutator
  13. {
  14. public:
  15.     virtual ~BaseMutator() = default;
  16.     BaseMutator(const MutationConfig& config)
  17.         : _config(config) {}
  18. protected:
  19.     virtual void mutate(MutationResult& result) = 0;
  20.     MutationConfig _config;
  21. };
  22.  
  23. class StandardMutator : public BaseMutator
  24. {
  25. public:
  26.     explicit StandardMutator(const MutationConfig &config) : BaseMutator(config) {}
  27.  
  28. protected:
  29.     void mutate(MutationResult &result) override
  30.     {
  31.  
  32.     }
  33. };
  34.  
  35. class CharMutator : public StandardMutator
  36. {
  37. public:
  38.     explicit CharMutator(const MutationConfig &config) : StandardMutator(config) {}
  39.  
  40. protected:
  41.     void mutate(MutationResult &result) override
  42.     {
  43.         StandardMutator::mutate(result);
  44.     }
  45. };
  46.  
  47. class StringMutator : public CharMutator
  48. {
  49. public:
  50.     explicit StringMutator(const MutationConfig &config) : CharMutator(config) {}
  51.  
  52. protected:
  53.     void mutate(MutationResult &result) override
  54.     {
  55.         CharMutator::mutate(result);
  56.     }
  57. };
  58.  
  59. class IntMutator : public StandardMutator
  60. {
  61. public:
  62.     explicit IntMutator(const MutationConfig &config) : StandardMutator(config) {}
  63.  
  64. protected:
  65.     void mutate(MutationResult &result) override
  66.     {
  67.         StandardMutator::mutate(result);
  68.     }
  69. };
  70.  
  71. class ArrayIntMutator : public IntMutator
  72. {
  73. public:
  74.     explicit ArrayIntMutator(const MutationConfig &config) : IntMutator(config) {}
  75.  
  76. protected:
  77.     void mutate(MutationResult &result) override
  78.     {
  79.         IntMutator::mutate(result);
  80.     }
  81. };
Tags: OOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement