passing an argument

Hi all,

I am a bit confused about configuring out the following problem.

I have a declared Macro(within a singleton class) which takes a parameter and generates an object with the same name like the parameter. Because I want to pass this parameter as argument in an API. I got always a compile error that reveals me that comiler can not generate this object because of "shadows a parameter"

1
2
3
4
5
6
7
8
9
10
11
12

SetPrameter(string St)
{
// How can I pass St to the Macro so that it interprets it as non-type variable? 
DECLARE_SOMETHING(St)
}
//////////
class singlton{
...
#define DECLARE_SOMETHING(Var) // generate an singleton object 
...
}

St is a parameter. St is also the name you choose for your singleton. I don't see what you're trying to do here..
Do you want to write a function that takes as an argument the name you want to give your class? You can't do that. Variable names exist in compile time and function arguments in run time. You can only pass names to macros. Why would you want to do this at all?
Topic archived. No new replies allowed.