Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
The Classes vs Object declaration Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
13-Jul-03
Category
Algorithm
Language
Delphi 2.x
Views
103
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Ido Kanner

99.9% (if not 100%) of the times we are using the Class declaration even when we do 
not need it.

Answer:

First of all lets clear what are the diffrences between the two type of 
declaration. 

Class declaration is actully like the TObject object. There isn't any diffrence 
between the 2 declarations: 

1   type
2     TMyClass1 = class
3       {.......}
4     end;
5   
6   //and the second declaration: 
7   
8   type
9     TMyClass2 = class(TObject)
10      {         ....... }
11    end;


If you will notice in delphi (in Delphi 3 and above) when you press on CTRL+Space 
you will find in the first declaration the same functions like the second 
declaration. 

And if you will look in the delphi help file, you will find that Class word created 
for components !!!! 

If you will declare this: 

12  type
13    TMyObject = object
14      { ....... }
15    end;


You will not find any function or property inside of it, if you did not declare of 
it. 
In the Delphi help file, they are writing that the Object declaration can not 
receave any properties. 

TheObject reserve word is very good for OOP of functions, like let say a CODEC (Encryption and Decryption) of the same thing, we can build it in OOP without the need of a component or a memory allocations (although we can).

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC