"quality central"???
> -----Original Message-----
> From: Myles Penlington [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 2 October 2002 3:47 p.m.
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Class refs in classes
>
>
> Thats a good one to report via quality central. Small and easily
> reproducible.
>
> -----Original Message-----
> From: Chris Milham [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 2 October 2002 3:45 p.m.
> To: Multiple recipients of list delphi
> Subject: [DUG]: Class refs in classes
>
>
> Hi,
>
> I have been trying to make a hierarchical library of routines
> using class
> procs/funcs. However Delphi 5 doesn't like me doing this.
> What I have tried to do is as follows (hope this makes sense.. only
> important bits included):
>
> type
> Tmyclass1 = class
> class procedure DoIt;
> end;
> Tmyclass1class = class of Tmyclass1;
> Tmyclass2 = class
> class1:Tmyclass1class;
> end;
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> Tmyclass1.doIt; // <- no probs with using a class proc
> // Tmyclass2.class1.doIt; // *** Delphi compiler doesn't
> like me doing
> this: accessing a class func through a ref to a class.
> end;
>
> class procedure Tmyclass1.DoIt;
> begin
> ShowMessage('Hello');
> end;
>
>
> The error Delphi gives is: method identifier expected.
> I can understand this (yes, I've read the help on it) but why??
> I have tried numerous ways of getting this to work but had to
> resort one
> option....
> I can work around this by simply having a class proc in Tmyclass2 that
> returns a Tmyclass1 class.
> eg.
>
> Tmyclass2 = class
> class function class1:TmyClass1class;
> end;
>
> class function Tmyclass2.class1: TmyClass1class;
> begin
> Result := tmyclass1;
> end;
>
> Then I can happily use this syntax: 'Tmyclass2.class1.doIt;'
> This seems a not-too-nice way of doing what I want.
> Any suggestions? Or am I trying to make Delphi be another language? ;)
>
> The other thing is: Is Delphi's optimiser smart enough to convert my
> 'class1' function in Tmyclass2 into a static reference? ie.
> am I going to
> have a performance hit because of trying to do this
> hierarchical library
> thing?
>
> TIA,
>
> Chris
>
> ---
>
> Chris Milham
> Software Developer
> MedTech Software Ltd.
> Level M, 48 Market Place, Viaduct Basin, Auckland
> Ph. +649 3559666 Extn. 714, Fax +649 3774231
> E-mail: [EMAIL PROTECTED]
> Web: http://www.medtech-software.com
>
>
> This e-mail and any attachments are intended only for the
> person to whom it
> is addressed and may contain privileged, proprietary, or other data
> protected from disclosure under applicable law. If you are
> not the addressee
> or the person responsible for delivering this to the addressee you are
> hereby notified that reading, copying or distributing this
> transmission is
> prohibited. If you have received this e-mail in error, please
> telephone us
> immediately and remove all copies of it from your system.
> Thank you for your
> co-operation.
>
> <<Chris Milham.vcf>>
> --------------------------------------------------------------
> -------------
> New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/