The is operator calls a class method to check that the object's class is
either the same as the compared to class or one of its children.  Using the
class type is the only way to test if an object is the same *BUT NOT* one of
its children.

Dennis.

----- Original Message -----
From: "Andreas Toth" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Friday, October 18, 2002 9:17 AM
Subject: RE: [DUG]: polymorphism problem


> Have I missed something, or, is the third point suggesting a rather odd
> technique of testing if an instance is of a specific class when the
> is-operator would have done a much tidier job?
>
>
> -Andreas
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:owner-delphi@;delphi.org.nz]On
> Behalf Of Dennis Chuah
> Sent: Friday, 18 October 2002 07:14
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: polymorphism problem
>
>
>
> I stepped through your code and it *DEFINITELY* calls TMetadata.Create.
> What you have done looks correct and this is certainly not a polymorphism
> pproblem.  Few suggestions:
>
> 1.  Check that you do not have $(DELPHI)\Lib in your project path - it
> should only be in the global library path.
> 2.  What if you replaced your code with:
>   NGraphic := TMetadata.Create;
>
> Step through the code - does it call TMetadata.Create?
>
> 3.  Check the class type of NGraphic and compare
Pointer(NGraphic.ClassType)
> against Pointer(TMetadata).  Are they the same pointer values?
>
> What version of Delphi are you using?
>
> Dennis.
>
> ----- Original Message -----
> From: Jianming Lin (ASL)
> To: Multiple recipients of list delphi
> Sent: Thursday, October 17, 2002 4:35 PM
> Subject: [DUG]: polymorphism problem
>
>
>
>
> G'Day, guys,
>
> procedure TryMetadata(ImgType : Integer);
> var NGraphic: TGraphic;
>     GraphicClass: TGraphicClass;
> begin
>   ImgType := 1;
>   case ImgType of
>     1 :  GraphicClass := TMetaFile;
>     2 :  GraphicClass := TBitmap;
>   end;
>   NGraphic := GraphicClass.Create;
> end;
>
>
> Why constructor  of TMetafile.Create is not called instead only
> TObject.Create is called?
>
>
>
>
>
> [Jianming Lin (ASL)]
>
>
>
>
>
> This e-mail message has been scanned for Viruses and Content and cleared
by
> MailMarshal - For more information please visit www.marshalsoftware.com
> --------------------------------------------------------------------------
-
>     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/
>
---------------------------------------------------------------------------
    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/

Reply via email to