Page Rank

Subscribe

Categories

Recent posts

Alexa Rank

Structure of C++ Program


  • A typical C++ program would contain four section.
  • They are Main function program, Member functions definitions, Class declaration and Include files.
  • These sections may be placed in separate code files and then compiled independently or joined.
Structure of C++

Structure of C++

INCLUDE FILES IN C++

  • Header File is a file that allows programmers to separate certain elements of program’s source code into reusable files.
  • Header file contains forward declaration of classes, variables and identifiers.

C++ DECLARATION

    • A Declaration introduces one or more name into a program.
    • Declaration can be occur more than once in a program.
    • Therefore classes, structures, enumerated and user-defined types can be declared for each compilation unit.
    • The constraint on this multiple declaration is that all declaration must be identical.


Example for C++ Declaration

MEMBER FUNCTIONS IN C++ PROGRAM

    • Classes can contain data and function.  These functions are referred to as “member functions”.
    • Any non-static function declared inside a class declaration is considered as a member function.

 

  • It is a common practice to organize a program into separate files.
  • The class declarations are placed in a header file and the definitions of member functions go into another file.
  • This approach enables the programmer to separate the abstract specification of the interface (class definition) from the implementation details (member functions definition).
  • 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 .
Client-Server Model

Client-Server Model

  • This approach is based on the concept of client-server model.
  • The class definition including the member functions constitute the server that provides service to the main program known as client.
  • The client uses the server through the public interface of the class.                                                       


VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">