[DUG] basic question

Dennis Chuah dennis_cs_chuah at hotmail.com
Thu Jul 26 07:40:35 NZST 2007


It is called a constructor ... subtle differences, but *significant*.  Eg., 
you cannot return a Nil from a constructor.  A constructor always 
instantiates an instance.

As for the use of class methods ... plenty.  Eg., use it to replace unit 
procedures and functions.  Use it to implement singleton classes and class 
factories.  Class methods can also be virtual and get overriden, etc.  The 
'self' parameter to class methods is the class reference.  Not as useless as 
Neven thinks.

----- Original Message ----- 
From: "David Moorhouse" <delphi at moorhouse.net.nz>
To: "NZ Borland Developers Group - Delphi List" <delphi at delphi.org.nz>
Sent: Wednesday, July 25, 2007 10:15 PM
Subject: Re: [DUG] basic question


> AnInstance := TAnObject.Create;
>
> if that's not a class method I'm not sure what is ;)
>
> D
>
>
> On Wed, 25 Jul 2007 21:33:25 +1200, you wrote:
>
>>Sean
>>
>>Thanks, I grovel corrected :-), Still little use with no data, ie Data +
>>Algorithms = Programs
>>
>>N
>>> Class methods have been around for years, explicitly.  As in
>>> TMyClass.DoSomething, no nil instances required.
>>>  have just looked it up in my "Using Delphi 3" (pub 1997) book that I 
>>> keep
>>> lying around for no apparent reason, so it's been at least a decade.
>>>
>>> Class variables etc are newer
>>>
>>>
>>> Regards
>>>
>>> Sean
>>> ---------------------------------------
>>> Sean Cross
>>> mailto:sean at sourceitsoftware.com
>>>
>>> Pics Print - The photo printing solution for Windows.
>>> http://www.picsprint.com
>>>
>>> Rental Property Manager - Rental management made easy
>>> http://www.sourceitsoftware.com
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: delphi-bounces at delphi.org.nz [mailto:delphi-
>>>> bounces at delphi.org.nz] On Behalf Of Neven MacEwan
>>>> Sent: Wednesday, 25 July 2007 8:19 p.m.
>>>> To: NZ Borland Developers Group - Delphi List
>>>> Subject: Re: [DUG] basic question
>>>>
>>>> Dennis
>>>>
>>>>> Class methods have been around since Delphi 2.  Where have you been
>>>>> all these years?
>>>>>
>>>> Not explicitly, as I said, you cannot for example call them on the
>>>> class, you call them on a nil instance
>>>> which is hardly elegant php for example you would call a class method
>>>> by
>>>> TClass::Method()
>>>>
>>>> To reinforce this, why did they introduce a 'class' keyword if they
>>>> were
>>>> already there?
>>>>
>>>> N
>>>>
>>>>> Class types, consts and vars came in D2006, I think, or might be in
>>>>> D2005.
>>>>>
>>>>> ----- Original Message ----- From: "Neven MacEwan" <neven at mwk.co.nz>
>>>>> To: "NZ Borland Developers Group - Delphi List"
>>>>>
>>>> <delphi at delphi.org.nz>
>>>>
>>>>> Sent: Wednesday, July 25, 2007 7:25 PM
>>>>> Subject: Re: [DUG] basic question
>>>>>
>>>>>
>>>>>
>>>>>> J
>>>>>>
>>>>>> My point is Delphi (generic) does not have Class Methods/Vars or
>>>>>> are you saying that 'Delphi' only applies to D2005+
>>>>>>
>>>>>> As for sarcasm, its a matter of opinion I found his response smug.
>>>>>>
>>>>>> N
>>>>>>
>>>>>>
>>>>>>> I'll answer for Chee Wee (not Chee - common mistake)
>>>>>>>
>>>>>>> These articles were by Nick about changes since Delphi 7.
>>>>>>> http://dn.codegear.com/article/34325 (VCL)
>>>>>>> http://dn.codegear.com/article/34323 (IDE)
>>>>>>> http://dn.codegear.com/article/34324 (Language)
>>>>>>>
>>>>>>> I don't think his original reply was sarcastic either. Why would he
>>>>>>> need to clarify something, you're the one that didn't do any
>>>>>>>
>>>> research
>>>>
>>>>>>> before saying something. Especially when coming from a version that
>>>>>>>
>>>> is
>>>>
>>>>>>> like 6 years old
>>>>>>> (http://delphi.wikia.com/wiki/Borland_Compiler_Release_Dates).
>>>>>>>
>>>>>>> Even if you don't run the latest version, it is hardly a great
>>>>>>>
>>>> effort
>>>>
>>>>>>> to subscribe to some blogs (www.delphifeeds.com).
>>>>>>>
>>>>>>> As for when they came in, they are a by product of Delphi.NET. So
>>>>>>> codegear doing .NET was good for something! So they came into the
>>>>>>> win32 around D2005 and have become less buggy each release since.
>>>>>>>
>>>>>>> cheers,
>>>>>>> Jeremy
>>>>>>>
>>>>>>>
>>>>>>>> Chee
>>>>>>>>
>>>>>>>> When did they sneak in?, Before you get all sarcastic I'd suggest
>>>>>>>>
>>>> you
>>>>
>>>>>>>> clarify things,
>>>>>>>> Some of us are using older versions (D6 in my case)
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> NZ Borland Developers Group - Delphi mailing list
>>>>>>> Post: delphi at delphi.org.nz
>>>>>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>>>>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with
>>>>>>> Subject: unsubscribe
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> NZ Borland Developers Group - Delphi mailing list
>>>>>> Post: delphi at delphi.org.nz
>>>>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>>>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with
>>>>>> Subject: unsubscribe
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> NZ Borland Developers Group - Delphi mailing list
>>>>> Post: delphi at delphi.org.nz
>>>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with
>>>>> Subject: unsubscribe
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> NZ Borland Developers Group - Delphi mailing list
>>>> Post: delphi at delphi.org.nz
>>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with
>>>> Subject: unsubscribe
>>>>
>>>
>>> _______________________________________________
>>> NZ Borland Developers Group - Delphi mailing list
>>> Post: delphi at delphi.org.nz
>>> Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: 
>>> unsubscribe
>>>
>>>
>>>
>>
>>_______________________________________________
>>NZ Borland Developers Group - Delphi mailing list
>>Post: delphi at delphi.org.nz
>>Admin: http://delphi.org.nz/mailman/listinfo/delphi
>>Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: 
>>unsubscribe
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject: 
> unsubscribe
> 



More information about the Delphi mailing list