C, I remember having operator overloaded functions for = well == in C. Does D4 support
this? I know it supports default parameters which is really cool. It seems to me that
D4 is very close to the C language these days, but is still a bit behind
(about 5 years).
It was really nice for structures as you could do
if (record1 == Record2)
Well I suppose you still had to do the compare routine, but it makes code a lot easier
to write.
How about friend functions?, and one I really miss from c is:
Say name is a string
Captionm := (Name > '') ? 'Hello'+Name : 'You should enter a name'
it is like an IF THEN ELSE in a line. first the comparason, then the ? means if TRUE
and the : means ELSE
So you could save a lot of typing if you wanted say 4 or 5 checks in one line of code.
Chris
Christopher Crowe (Software Developer)
Microsoft MVP, MCP
Adrock Software
Byte Computer & Software LTD
P.O Box 13-155
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of YanboL
> Sent: Thursday, 8 April 1999 15:54
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Comparison of records
>
>
> It's a typical Pascal concept, same as C.
>
> Suppose the record type has a TYourObject field, TYourObject in the two
> records reference the same date area. How can you expect the compiler to
> compile "=".
>
> If you really want to compare records, you have to define you own
> function
> or method.
>
> Cheers
>
> -----Original Message-----
> From: Phil Scadden [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, 8 April 1999 13:59
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Comparison of records
>
>
> >This got to be a naive question, but I need an enlightenment either
> >theoretical or practical. In the following code I tried to compare
> >two record type variables which belong to the same record type:
>
> If the record contains strings, objects, pchars, etc. then its
> did it hard
> way
> as far as I know. Fixed size records of simple types (eg a common one for
> me is Record
> x,y:Double;
> end; )
> then you can try type Casting to fixed type for comparison.
>
> ----------------------------------------------------------
> Phil Scadden, Institute of Geological and Nuclear Sciences
> PO Box 30368, Lower Hutt, New Zealand
> Ph +64 4 5704821, fax +64 4 5704603
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
>
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz