Re: [sv-ec] class with an enum

From: Steven Sharp <sharp_at_.....>
Date: Thu May 01 2008 - 14:59:49 PDT
>Does a class which contains an enum declaration require any special 
>processing at elaboration time or will the class be constructed like 
>regular, nonparameterized classes with a call to the new function the 
>that class?
>
>class C;
>  enum {red, yellow, blue} colors;
>endclass // C

The enum declaration doesn't require anything to be done by the class.
It works the same as if the enum type were declared outside the class,
except that the names are only visible inside the class.


>I assume that there is no special processing needed unlike a class with 
>parameters.

The only similarity I can see is that both involve named constants local
to the class.  But the reason for special processing with parameters is
that different class instances/handles can set the parameters to different
values, creating different types.  You can't override an enum.  If you
set an enum value from a class parameter, it could vary between different
specializations of the class type.  But that is just an aspect of the
override of the parameter, not of enums.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu May 1 15:00:27 2008

This archive was generated by hypermail 2.1.8 : Thu May 01 2008 - 15:00:37 PDT