Ok this is a really interesting question that could be rather useful in the right situations but I'm not sure if it's possible.
I've been doing a little reading on macros for something else when I came across "stringification". The tutorial says that if I define a macro to a certain value or string I can convert this macro to what it defines by using the '#'.
#define MAC "macroString"
cout << "Macro MAC contains: " << #MAC << endl;
So... Is it possible to create classes using a the definition of the macro to setup the class name?
1 2 3 4
#define MAC "Object"
Would this work (if it works at all) with the same functionality as:
I know the #define is for setting up replacement macros but this is what I want it for.
So basically I can create a class and as the program reads the macro it should be replaced by the compiler right??
So if I had:
1 2 3 4 5
#define CLASSNAME "Object"
The CLASSNAME macro should be completely replaced with "Object" shouldn't it? Thus giving the class definition the same functionality as:
1 2 3
I think this would work somehow but I'm not sure if it'd need the 'stringify #' or not? Or if it'd work at all?
That's the beauty, I'm not wanting to use constructors and destructors for these classes. I plan to create derived classes which are basically just containers of a superclass with only values changed... Trust me I know a way how to make it work if I can do this!
Well yes I was planning to test it out but I was away from my computer when I wanted to know so I thought I'd ask if it was possible and if anybody had any tips or problems I may need to face first.
Ah thanks for that, and trust me I have my uses! XD
Basically I want a program that is practically nothing and in a way, practically compiles itself based on files in a specified directory.