Day 5 - Bug. Save by #define


I tested program that uses MyClass.
In some cases calc doesn't work well.
And what is more the function is not optimised and it uses up to much time and memory.
It can be better.

But alas I have to change four files.
What if it happens again or the same thing happenes for another class.
I must find the way out.

And it is #define.
I have to make the file MyClass.hpp again.
file: MyClass.hpp

 #define Generator_MyClass(DP_class)                                                 \
  class MyClass_##DP_class                                                           \
   {                                                                                 \
    public:                                                                          \
     MyClass_##DP_class( DP_class P_a ): M_a( P_a ) { }                              \
                                                                                     \
     void clac(){std::cout << "Do not disturb! calc in progress ..." << std::endl; } \
                                                                                     \
    private:                                                                         \
     DP_class a;                                                                     \
   }
File MyClass_char.hpp and the rest of them, I forgot whitch ones
become:
file: MyClass_char.hpp
 #ifndef _HPP_MyClass_char
  #define _HPP_MyClass_char
  #include "MyClass.hpp"
   Generator_MyClass(char)
 #endif

file: MyClass_int.hpp
 #ifndef _HPP_MyClass_int
  #define _HPP_MyClass_int
  #include "MyClass.hpp"
   Generator_MyClass(int)
 #endif

file: MyClass_double.hpp
 #ifndef _HPP_MyClass_double
  #define _HPP_MyClass_double
  #include "MyClass.hpp"
   Generator_MyClass(double)
 #endif

The old code which MyClass_XYZ uses I don't have to change. It works fine.
I can't imagine what will happen if I forget to chahge some of old classes.