|
From: Ioannis V. <no...@ya...> - 2001-04-09 14:53:51
|
In the case of a class there is no reason to have 2 files, since it can only defined once (in one file, or manually many times in separate files but using exactly the same definition-a habbit leading to troubles. Only #includes of the definition is the right way). So my guess is that in the implementation file he #includes the .h file (or the opposite). Ioannis * Ioannis Vranos * Programming pages: http://members.nbci.com/noicys * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...]On Behalf Of > Richard Southworth > Sent: Monday, April 09, 2001 10:09 AM > To: dev...@li... > Subject: [Dev-C++] Header Files > > > Hi. > > I'd be grateful if someone could write a few lines to > help me understand header files. > > I know that #include is used to read source code from > a file into the current file, and that MyClass.h holds > the declaration of a class whereas MyClass.cpp holds > the definition of the class. The MyClass.cpp file has > a #include "MyClass.h" so that it reads in the class > declaration. > > I'm a bit confused as to why, in any examples I see, a > main.cpp file uses #include "MyClass.h": shouldn't the > main.cpp file require both the class declaration and > its definition? > > Many thanks. > > Richard > > ____________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk > or your free @yahoo.ie address at http://mail.yahoo.ie > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |