Topic: enum - inherited


Author: mtm4@rsvl.unisys.com (Mike McCormick)
Date: 1995/05/31
Raw View
In article <2fc10962.52414953544c494e@raistlin.tng.oche.de> stephan@raistlin (Stephan Kreutzer) writes:

>>John D. Prokopek <70414.1516@CompuServe.COM> writes:

>>>I had read somewhere that it is possible for an enum to inherit
>>>from another enum.

>>No. Only a class may inherit, and then only from another class.

>Hi Steve !
>What you wrote above is not completely true. Not only a class
>but also structures can inherit from each other.
>( I don't know what happens if a class inherits from a structure
>or vice versa ...)

This is a red herring, because in C++ a struct is a kind of class.

------------------------------------------------------------------
 Mike McCormick
 mtm4@rsvl.unisys.com
 m.mccormick2@genie.geis.com
------------------------------------------------------------------
 While you're out surfing the internet...
 I'm back on the beach blowing my little lifeguard whistle.
------------------------------------------------------------------





Author: jsdy@cais2.cais.com (Joseph S. D. Yao)
Date: 1995/05/25
Raw View
In article <3pi1vo$3v1$1@mhafc.production.compuserve.com>,
John D. Prokopek  <70414.1516@CompuServe.COM> wrote:
>I had read somewhere that it is possible for an enum to inherit
>from another enum. If this is so what is the syntax? ...

Only classes can inherit from each other.  Two interesting examples of
classes (as defined in the Standard) are structs and unions.

The confusion may have come about because enums also follow some of the
same rules as the other types of classes.  However, they aren't classes.

--
Joe Yao    jsdy@cais.com - Joseph S. D. Yao





Author: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Date: 1995/05/27
Raw View
John D. Prokopek <70414.1516@CompuServe.COM> writes:

>I had read somewhere that it is possible for an enum to inherit
>from another enum.

You must have been reading about some other language.
It is not possible in C++.

--
Fergus Henderson
fjh@cs.mu.oz.au
http://www.cs.mu.oz.au/~fjh





Author: stephan@raistlin (Stephan Kreutzer)
Date: 1995/05/23
Raw View
In article <3pnllp$3du@engnews2.Eng.Sun.COM>,
Steve Clamage <clamage@Eng.Sun.COM> wrote:
>John D. Prokopek <70414.1516@CompuServe.COM> writes:

>>I had read somewhere that it is possible for an enum to inherit
>>from another enum.

>No. Only a class may inherit, and then only from another class.
Hi Steve !
What you wrote above is not completely true. Not only a class
but also structures can inherit from each other.
( I don't know what happens if a class inherits from a structure
or vice versa ...)

Bye,
   Stephan

--
Stephan Kreutzer             stephan@raistlin.tng.oche.de





Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/05/23
Raw View
In article 52414953544c494e@raistlin.tng.oche.de, stephan@raistlin (Stephan Kreutzer) writes:
>In article <3pnllp$3du@engnews2.Eng.Sun.COM>,
>Steve Clamage <clamage@Eng.Sun.COM> wrote:
>
>>No. Only a class may inherit, and then only from another class.
>Hi Steve !
>What you wrote above is not completely true. Not only a class
>but also structures can inherit from each other.
>( I don't know what happens if a class inherits from a structure
>or vice versa ...)

A class is a struct, and a struct is a class. The ONLY difference is
the default access. You can even write

 class A; // forward declarations
 struct B;
 ...
 // definitions:
 struct A { ... };
 class B { ... };

---
Steve Clamage, stephen.clamage@eng.sun.com







Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/05/21
Raw View
John D. Prokopek <70414.1516@CompuServe.COM> writes:

>I had read somewhere that it is possible for an enum to inherit
>from another enum.

No. Only a class may inherit, and then only from another class.

A derived class inherits the enums of its base classes, of course.

--
Steve Clamage, stephen.clamage@eng.sun.com





Author: John D. Prokopek <70414.1516@CompuServe.COM>
Date: 1995/05/19
Raw View
I had read somewhere that it is possible for an enum to inherit
from another enum. If this is so what is the syntax? I have tried
various forms to no avail. Then again who knows what my compiler
would make of it anyhow.
any reply would be appreciated,
john prokopek
compuserve 70414,1516