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?
Create another macro to declare these variables:
Eventually if you want the same file to booth declare and define them, you can use sth like this:
but this makes sense only when there are many, many, many of these (many globals? hmmm…) and the list is being changed frequently, generally this is unusual