Declaration for object for which creation is wrapped in macro

Posted by learner on Stack Overflow See other posts from Stack Overflow or by learner
Published on 2010-06-09T17:30:42Z Indexed on 2010/06/09 17:42 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

The following macro is defined in our code:

#define  MSGMacro(obj, arg)  MyPaymentClass obj(arg)

Where MSGMacro is used to creates the object of type MyPaymentClass using code like

MSGMacro(Card, 1);
MSGMacro(Cash, 2);
----
---- //removed unwanted things to keep question cleaner. 

All the above code is in one cpp file, Now the problem is how we can expose these two objects of MyPaymentClass to other units in my project? i.e. I want to use Card and Cash in other CPP files. Please suggest how I can give the declaration for the same in some header file?

© Stack Overflow or respective owner

Related posts about c++

Related posts about macros