A C++ program would
contain four sections. These sections may be separate code files and then
compiled independently or jointly.
INCLUDE FILES
|
CLASS DECLARATION
|
MEMBER FUNCTION DEFINATION
|
MAIN FUNCTION PROGRAM
|
Structure of C++ program
It is a common practice to organize a
program into three separate files. The class declarations are placed in header
file and the definitions of member function go into another file. This approach
enables the programmer to separate the abstract specification of the interface
(class definitions) from the implementations detail (member functions
definition.)
Finally, the main program that uses
the class is placed in a third file which includes the previous two files as well
as any other files required.This approach is based on client server model. The
class definition including the member functions constitute the server that
provides services to the main program known as client.
0 comments:
Post a Comment