Board index » delphi » componenrt and class

componenrt and class


2003-10-16 12:25:57 PM
delphi158
what is the difference btween component and class??
 
 

Re:componenrt and class

Hello, pti!
You wrote on 15 Oct 2003 21:25:57 -0700:
Quote
what is the difference btween component and class??
At it is most basic, a component is anything that derives from TComponent,
and a class is anything that derives from TObject. Since TComponent itself
derives from TObject, all components are classes. However, only components
can be placed on a form, frame, or datamodule at runtime.
Cheers.
Ignacio
 

Re:componenrt and class

Hi,
There an other difference :
A class is the definition of a familly of object. It can be overrided to add
new feature (the inheritance).
A component is in fact an instance of a class. There may be lot's of
instances of the same class, writing classes avoid writing lot's of code
because the instance use the same code.
There a relation : Instance=Class.Create(params).
in Delphi : Class=Instance.ClassType.
There an easy way to separate class and instance in delphi : Class name most
time begin with a T for all derived from TObject, and wih an E for all class
inherited from Exception.
Regards,
Florent.
"pti" <XXXX@XXXXX.COM>a écrit dans le message de
Quote

what is the difference btween component and class??
 

Re:componenrt and class

Hello, Florent!
You wrote on Thu, 16 Oct 2003 13:30:43 +0200:
Quote
A component is in fact an instance of a class.
No, this is just a class instance, and not in fact a component. You can have
multiple instances of any class (including classes that are components), but
they aren't considered components.
Cheers.
Ignacio
 

Re:componenrt and class

You're write
A component is an instance of a class derived from TComponent.
But aa class is different from an instance and so from a Component.
Regards,
Florent.
"Ignacio Vazquez" <ivazquezATorioncommunications.com>a écrit dans le
message de news:XXXX@XXXXX.COM...
Quote
Hello, Florent!
You wrote on Thu, 16 Oct 2003 13:30:43 +0200:
>A component is in fact an instance of a class.

No, this is just a class instance, and not in fact a component. You can
have
multiple instances of any class (including classes that are components),
but
they aren't considered components.

Cheers.
Ignacio