Global CList

Hi there,
Is there a way to declare a global CList??
If yes, how do you declare this CList in other modules??
eg.
struct myStruct{
           CString var1;
           int var2;
          };

CList<myStruct,myStruct>list_struct;
CList<CString,CString>list_str;

so in this case, how do I declare these 2 list in other "*.h" files?
I am using MSVC++ 4.0

Thanks.
elvAsked:
Who is Participating?
 
RONSLOWConnect With a Mentor Commented:
>Is there a way to declare a global CList??

Yes

>If yes, how do you declare this CList in other modules??
>eg.
>struct myStruct{
> CString var1;
> int var2;
> };
>CList<myStruct,myStruct>list_struct;
>CList<CString,CString>list_str;
>
>so in this case, how do I declare these 2 list in other "*.h"
>files?

Just like that - but put an extern in front for the .h

0
 
elvAuthor Commented:
Adjusted points to 100
0
 
elvAuthor Commented:
ie in the other .h files,

extern CList<myStruct,myStruct>list_struct;
extern CList<CString,CString>list_str;
0
 
RONSLOWCommented:
That should be it.

In the defining .cpp you would have these lines WITHOUT the 'extern' in front - that then make the line a 'definition' instead of a 'declaration'.


0
All Courses

From novice to tech pro — start learning today.