-
Which of Them Work First
I am new in C development and have to understand a program which was written with Borland Compiler, but something make it dificult to understand there are two functions in program one of them is:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
Other is:
void __fastcall TForm1::FormCreate(TObject *Sender)
but I confused which of them works first, and when they are triggering one of them constructor and other one is a form create event I really about to lose the plot pls help me.
Thanx you in advance.
-
This is C++. Should be moved there too.
-
Well, it's C++ and not C, so....
But anyway:
Code:
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
This is a C++ constructor for a TForm1 object. It is called when a new TForm1 object is created and given a TComponent pointer.
Code:
void __fastcall TForm1::FormCreate(TObject *Sender)
This is a function belonging to TForm1. If it's static, then it belongs to the class and can be called without a TForm1 object being present, and hence could be called first. Otherwise, you need a TForm1 object in order to call this function, and I would expect a constructor from TForm1 must be called first.
-
The code is a C code, but maybe vcl working in c++ and c and probably in delphi as well. Its just a dll no more, Do I need to open same topic in other forums as well?
Thanx u MacGyver, I understood one of them need to be called other one is a constructor and will be caled automatically, ok then I think at first formcreate will also call automatically but now everything is much more clear thank you in advance
-
No, a moderator will move it.
-
It is certainly C++ or some other OOP. C doesn't support classes. (Lol, MacGyver, you were faster this time. :) )
-
C doesnt support but vcl support classes :) whatever thanx for your help again and other time I would be more careful. Forgive me I am used to use lego languages such as c#. C looks to memore than a nightware.
-
http://en.wikipedia.org/wiki/Visual_Component_Library
According to that page, VCL is written in Object Pascal and can be used by C++ in the manner that you're doing. Looks like C++ to me. ;)
-
-
VCL != C
VCL is indeed written in Object Pascal and has interfaces with C++ and Delphi (and maybe C# by now as well, not sure about that).
In no small part that's because Borland C++ Builder and Delphi share the same linker, so obj and lib files created with either can be linked against obj and lib files created with the other.