classes

what is the importence of implementing the class seperately as a heder file & the methods seperately & the main programme seperately how can i compile them in the unix environment
If the class is defined in a header file, that header can be included in other sources files, and used by classes defined in those other source files.

If you do it all in one file, the only way you can use members of that class is from code within the same file, or by including the source file in another source file which, unless you're very careful, will introduce all sorts of problems with multiply defined code.
As bnbertha indicated, it is a matter of modularization.
http://en.wikipedia.org/wiki/Modularity_(programming)

You can think of a header file as an interface to your module. It is used to tell other modules what kind of stuff is in your module and how it can be accessed.

The c or cpp file is the module code which gets compiled to an object file (*.o or *.obj), which in turn gets linked together with all the modules that make up your application into an executable file.

Hope this helps.
thankx people it was really helping you know understanding the purpose is good 4 any thing
Topic archived. No new replies allowed.