Path: 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> <48805@nigel.ee.udel.edu> Organization: IR Lines: 12 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