Topic: Re^2: run-time type checking (was: Covariant Types in Derived Classes)


Author: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Date: Tue, 21 Jul 1992 15:34:05 GMT
Raw View
In article <14feqsINNt9d@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
>In article <694@data.rain.com> kend@data.rain.com (Ken Dickey) writes:
>>shang@corp.mot.com (David (Lujun) Shang) writes:
>>>Then, once you put an object into a heterogeneous collection, the
>>> object will lose its specific characteristics forever.
>>An object cannot be a member of more than 1 set ???  8^)
>
>Shang didn't really describe it well.  The collection is presumably a set
>of pointers or references, and it's those pointers/references that lose
>their more specific characteristics; static type checking limits you to
>treating them as objects of the class defined by the collection.  The
>original objects to which they refer still retain all their
>characteristics, though.  In particular, virtual function calls will use
>the overriding definitions in derived classes.  But members that are only
>declared and defined in derived classes cannot be accessed through the
>collection.
>
>If an object is referenced by more than one set, each set will define which
>aspects of the object can be accessed.

 A mechanism facilitated by multiply inheriting from various
abstract bases: one for each set you want the object to be in.

>--
>Barry Margolin
>System Manager, Thinking Machines Corp.
>
>barmar@think.com          {uunet,harvard}!think!barmar


--
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
 Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------




Author: kend@data.rain.com (Ken Dickey)
Date: 20 Jul 92 16:36:55 GMT
Raw View
shang@corp.mot.com (David (Lujun) Shang) writes:

>Then, once you put an object into a heterogeneous collection, the
> object will lose its specific characteristics forever. If you put a
> dog into a animal collection, you can never recognize it as a dog.
> Suppose that your system live on an object server, once you put an
> object into the server, you'll never get it back as the original one.
> Now, are you willing to rely your system on this object server?

An object cannot be a member of more than 1 set ???  8^)


-Ken




Author: barmar@think.com (Barry Margolin)
Date: 20 Jul 1992 22:30:52 GMT
Raw View
In article <694@data.rain.com> kend@data.rain.com (Ken Dickey) writes:
>shang@corp.mot.com (David (Lujun) Shang) writes:
>>Then, once you put an object into a heterogeneous collection, the
>> object will lose its specific characteristics forever.
>An object cannot be a member of more than 1 set ???  8^)

Shang didn't really describe it well.  The collection is presumably a set
of pointers or references, and it's those pointers/references that lose
their more specific characteristics; static type checking limits you to
treating them as objects of the class defined by the collection.  The
original objects to which they refer still retain all their
characteristics, though.  In particular, virtual function calls will use
the overriding definitions in derived classes.  But members that are only
declared and defined in derived classes cannot be accessed through the
collection.

If an object is referenced by more than one set, each set will define which
aspects of the object can be accessed.
--
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar