comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Dinamic type checking
Date: 1998/08/27
Date: 1998-08-27T00:00:00+00:00	[thread overview]
Message-ID: <m3soijtfe3.fsf@mheaney.ni.net> (raw)
In-Reply-To: 35E16F1D.2E41DD75@tech.swh.lv

Maxim Senin <maks@tech.swh.lv> writes:

>  in Java:                               in Ada:
>  class A {}                             type A is tagged private;
>  class B extends A {}                   type B is new A with private;
>  ...                                    ...
>  B b;                                   objectOfTypeB : B;
>  ...                                    ...
>  if (b instanceof A) {                  if (objectOfTypeB'Tag = A'Tag) then
>      ...                                  -- this will not work 'cos "=" produces exact match
>  }                                      end if;

Use a membership test:

if objectOfTypeB in A'Class then ...;




      parent reply	other threads:[~1998-08-27  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <35E16F1D.2E41DD75@tech.swh.lv>
1998-08-24  0:00 ` Dinamic type checking Samuel Tardieu
1998-08-25  0:00 ` Gene Ouye
1998-08-27  0:00 ` Matthew Heaney [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox