Article View: comp.lang.misc
Article #3206Re: CHALLENGE: heterogeneous collections
From: Dan Bernstein
Date: Tue, 26 Mar 1991 23:28
Date: Tue, 26 Mar 1991 23:28
12 lines
1055 bytes
1055 bytes
In article <48805@nigel.ee.udel.edu> new@ee.udel.edu (Darren New) writes:
> Hmm... How about a window with a hetrogeneous collection of buttons, sliders,
> text displays, etc, all of which respond to "redraw" and "is the mouse
> over you"?
struct { any object; void (*redraw)(); int (*ismouseover)(); } *whatsinwindow();
Here ``any'' is a polymorphic type (e.g., void * in C), and *redraw
takes an ``any'' argument. Naturally, languages like C++ encapsulate the
above struct into a single ``class,'' but that's merely syntactic sugar.
---Dan
Technical Details
Message-ID:
<7689:Mar2623:28:5091@kramden.acf.nyu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstndReferences:
<1991Mar22.210725.29448@neon.Stanford.EDU> <pallas.669923769@red-dwarf> <48805@nigel.ee.udel.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: CHALLENGE: heterogeneous collections Message-ID: <7689:Mar2623:28:5091@kramden.acf.nyu.edu> Date: 26 Mar 91 23:28:50 GMT References: <1991Mar22.210725.29448@neon.Stanford.EDU> <pallas.669923769@red-dwarf> <48805@nigel.ee.udel.edu> Organization: IR Lines: 12