Download Practical C Programming - International Research Institute MICA
Transcript
Public and Private 305 Also, as programming problems get bigger, more and more programmers are needed to finish them. An efficient way of splitting up a large project is to assign each programmer a different module. In this manner, each programmer only worries about the internal details of a particular module. In this chapter, we will discuss a module to handle infinite arrays. The functions in this package allow the user to store data into an array without worrying about its size. The infinite array grows as needed (limited only by the amount of memory in the computer). The array will be used to store data for a histogram, but can be used to store things like line numbers from a cross-reference program or other types of data. Public and Private Modules are divided into two parts: public and private. The public part tells the user how to call the functions in the module. It contains the definition of data structures and functions that are to be used outside the module. These definitions are put in a header file, and the file must be included in any program that depends on that module. In our infinite array example, we have put the public declarations in the file ia.h, which we will look at shortly. Figure 18-1 illustrates the relationship between the various parts of the infinite array package. Public Definitions imported through #include ia.h directive ia.h Definition of ia hist.c Private ia.c Use of ia Implementation of ia Figure 18-1: Definition, implementation, and use of the infinite array Anything that is internal to the module is private. Everything that is not directly usable by the outside world should be kept private. One of the advantages of C++ over C is that you can explicitly declare what is public and what is private, and prevent unauthorized modification of private data.
Related documents
Filter Service
EPIO User Manual - Digalog Systems, Inc.
Model 2520Pulsed Laser Diode Test System User`s Manual
Cycle-PO4 Manual
A SERIES OF SHORT EGS5 TUTORIALS
What is IDEA?
Download, 3.57 MB
CHICKEN User`s Manual - The User`s Manual
to the Owners Manual for the pureHeat 2-in
M362-4 and -9 UPS USER MANUAL
86120B User Manual - Custom-Cal
FP-550 User`s Manual