The general structure of C++ program can be shown in following diagram.
- In C++ program, first section is the include section
- It contains pre-processor statements to include various header (library) files.
- After the include section there is class declaration section.
- In class declaration we are defining class, its member variable and declaration for the member function.
- Class member function definition section contains the definition of various class member functions.
- At last there is a main function, which start the execution of program and create the object of class.
- Generally in C++ program class declaration, class member function definition and main program is written in three separate files.
- Class declaration file and class member function definition file is included into the main program to link all of them.
- This structure is known as the client-server architecture.
- In client-server architecture we have client requests for service to server and server provides service to client.
- One client can get service from more than one server and similarly one server can provides the service to multiple clients.
- Same fundamental is used at here. Class is act as server and program acts as client.
- Main program (Client) can use more than one class (Server) similarly one class (server) can be used for more than one program (client).