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 '#'.
i.e.
1 2
#define MAC "macroString"
cout << "Macro MAC contains: " << #MAC << endl;
macroString
So... Is it possible to create classes using a the definition of the macro to setup the class name?
i.e.
1 2 3 4
#define MAC "Object"
class #MAC{
//class definition
}
Would this work (if it works at all) with the same functionality as:
@Computergeek01
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"
class CLASSNAME{
//class definition
}
The CLASSNAME macro should be completely replaced with "Object" shouldn't it? Thus giving the class definition the same functionality as:
1 2 3
class Object{
//class definition
}
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?
@ResidentBiscuit
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!
@ResidentBiscuit
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.
@Disch
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.