🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1326

Re: Inheritance for enum types ???

#1326
From: Stephen J Bevan
Date: Mon, 27 May 1991 19:25
28 lines
1643 bytes
In article <CIMSHOP!DAVIDM.91May26223941@uunet.UU.NET> cimshop!davidm@uunet.UU.NET (David S. Masterson) writes:

>>>>> On 25 May 91 07:43:08 GMT, rfg@lupine.ncd.com (Ron Guilmette) said:

Ron> this sounds like a job for ... ta da!  Inheritance!

Ron> 	enum light_color { pink, yellow, aqua };
Ron> 	enum color : light_color { red, green, blue };

David> This is a bit confusing as you would tend to think of Light_Color as a
David> derivative of Color, not vice versa.

Your not alone in this thought.  Cardelli and Wegner define inclusion
polymorphism (or inheritance if you prefer) for variant types (enums
in C++) in this way.  For anyone that is interested in these sorts of
issues, I recommend reading :-

On Understanding Types, Data Abstraction and Polymorphism
L. Cardelli and P. Wegner
Computing Surveys 17(4):480-521 December 1985

and :-

Type Theories and Object-Oriented Programming
Scott Danfor and Chris Tomlinson
Computing Surveys 20(1):29-72 March 1988

Stephen J. Bevan			bevan@cs.man.ac.uk
Technical Details
Message-ID: <BEVAN.91May27202516@panda.cs.man.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!mucs!m1!bevan
References: <5701@lupine.NCD.COM> <CIMSHOP!DAVIDM.91May26223941@uunet.UU.NET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!mucs!m1!bevan
From: bevan@cs.man.ac.uk (Stephen J Bevan)
Newsgroups: comp.std.c++
Subject: Re: Inheritance for enum types ???
Message-ID: <BEVAN.91May27202516@panda.cs.man.ac.uk>
Date: 27 May 91 19:25:16 GMT
References: <5701@lupine.NCD.COM> <CIMSHOP!DAVIDM.91May26223941@uunet.UU.NET>
Sender: news@cs.man.ac.uk
Distribution: comp
Organization: Department of Computer Science, University of Manchester
Lines: 28
In-reply-to: cimshop!davidm@uunet.UU.NET's message of 27 May 91 05:39:41 GMT