multiple source files

Alright, I've never used multiple source files in my projects, never had a need to. But I find my self wanting to now and I'm curious how to use a class I defined in one source file in another. I thought about just
extern class className;
but that wont work will it? so I ask if anyone knows how to do this and if they would kindly tell me...It would also be cool if you could explain the way it works on a fundamental level, but don't worry about doing that if you don't have time :P
No need for extern.

See this article:

http://cplusplus.com/forum/articles/10627/

EDIT:

short answer: don't put your classes in .cpp files unless they're only used in that cpp file.

If they're used in multiple cpp files, put the class definition in the header (but keep the non-inline function bodies in the .cpp file)
Last edited on
thanks Disch, that fixed my problem

edit: Yea the only reason I wasn't doing that was I was worried about it spitting out a multiple definition error.
Last edited on
Topic archived. No new replies allowed.