[continuation from external classes ]
to broaden the question... can i use the extern keyword for userdefined types? apparently it doesn't work... [with classes at least]... i'm using DJGPP... thank you very much...
[continuation from external classes ]
to broaden the question... can i use the extern keyword for userdefined types? apparently it doesn't work... [with classes at least]... i'm using DJGPP... thank you very much...
hasafraggin shizigishin oppashigger...
You can't extern declarations. For instance, it wouldn't make any sense to do -
extern int;
You have to extern objects/instances of types -
class MyClass
{
public:
int b;
};
extern MyClass c;
extern int a;
//etc
extern isn't used to enlarge the scope of declarations (that's why you include header files), but to share variables between files.
zen
so since i can't do that... that means that i'll have to either seperate the class declarations and poly-include them [so i only have one floating copy] or i'll have to create another copy...
that's what i had going for me before, but now that i've reorganized my huge nested class structure [meanwhile raising the kb/srcfile from 2 kb per to 6 kb per...] i'll have to go back to the way i had it before... is there an alternative if i still want seperate compilation? right now it's working since i'm not using seperate compilation... [granted, it's not really a necessity to have linking, since compile time isn't _that_ large at all... but it was back in the old day when my system was slower...]
thanks for your time...
hasafraggin shizigishin oppashigger...
No, you'll have to put the class declaration in a header file and include it in every file that uses an instance of the class.is there an alternative if i still want seperate compilation?
However, you only have to put the declaration in the header file and not the definition of all the class member functions (unless you're inlining or using templates). The member definitions can go in their own cpp file which you wont have to include. Unless you've got a very large class declaration, it shouldn't add 4kb to each source file it's included in.
zen
yeah, gotcha... what i'll probably do is put _all_ of the class declarations [since it is a nested class structure] in one file... and leave the seperate function definitions per class... that way my average won't decrease that much, and i have one header i can poly include per source file...
PS, what's the term for all the code that produces one object file? if i say 'source file', like i just did, it could mean just one file which is necessarily the whole object source code included in that object file... thanks alot...
hasafraggin shizigishin oppashigger...
Translation unit.PS, what's the term for all the code that produces one object file?
zen
thanks! say, do you have an AIM handle or MSN handle zen? myne is doubleanti
hasafraggin shizigishin oppashigger...