A problem! !

Category: C/C++ -> Foundation Classes Author: zheyejiaolanqiu Date: 2001-07-19 04:24:26
2001-07-19 04:24:26
Will C + + Builder in the suffix of each file are different, they are certainly not a files!

their respective roles and functions, what is it? . Cpp not contain all the files ah! . H header file is not done? Is not all documents are in the. cpp in it? Confusion, experts give a detailed analysis and answers! ! Thank you!
2001-07-19 04:52:00
There are several unit files, are likely to use global variables, and asked: Declare / Define / use, respectively, on what file? What do I need explanation? such as extern like garbage ...
declarations into header files inside, the definition into cpp file which preceded extern??
in a.h file,

extern Integer var;

in a.cpp file,

Integer var;

need to use in other ; var variable. cpp in,

# include "a.h"

then you can in this. cpp access ; var it.

2001-07-19 05:26:33
We know that statement to put the header file, but here there are N header file, like BCB project, there is one pair for each form element cpp and h files. seems No one is the master and the master h cpp file.
Thus, we see that a typical bcb project, there is:
a main program cpp file: project.cpp, no h file
bunch form the cpp file and paired h file. shaped like: form1.cpp, form1.h
several custom functions and variables cpp file and h file. shaped like: myclass.cpp, myclass . h
if I want to use global variables in form2.cpp/form3.cpp where myclass * myglobe; these definitions and declarations into what?
place in use, how should we make ?

above you can form2.cpp/form3.cpp li # include "myclass.h"
then new with objects, exhausted after delete it. If you frequently used functions
it can also be defined as static, then myclass :: myfunc (), of course, also
# include "myclass.h", if it is variable, such as: int iName can be defined as:
extern int iName;

2001-07-19 06:00:15
Also, I would like to ask how to see these different extension files! !
2001-07-19 06:30:23
declare global variables in *. h file class declared outside on the line