Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is member of an inherited class of TForm global? 1

Status
Not open for further replies.

hajimeml

Programmer
Apr 17, 2009
18
CN
Hello, I have a C++ Builder 6 program written by others. When the program is executed, there is a main form. Depending on the buttons being pushed, different forms appear on the screen to prompt the users for appropriate actions. In Main.h, there is a class definition as follows:

class TFormMain : public TForm
{
_published:
:
: (lots of stuffs here)
:
private:
CHouse *ABCPtr;
:
}

When I looked at the codes of other forms (written in separate files), I found that some of the functions mention ABCPtr without using class resolution symbol ::. I also cannot find the pointer ABCPtr being defined elsewhere.
Is ABCPtr a global variable? If not, how come member functions of other classes can use it? thanks.
 
One of the options in compiling is to include the header files in the called forms. If this is set, then the other forms will see the main form's class as a friend and be allowed to use the private pointers.

To access this option, go to File->Include Unit Hdr. You can set it so only the main form includes the unit headers, or only the called forms include the unit header(s), or both. You can select which unit headers are included. Read the help file for more info.



James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Thank you very much for the very useful information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top