Chapter 15 Working with IDL


Struct / Enum as switch data type

You can use an enum or a struct as switch data type using a composition association. In this situation, the composition role is used as switch attribute for the union.


union Screen switch(Colors) {
   case red:
      short background;
   case blue:
      short foreground;
};

If you do not use the composition role as switch attribute, you still have to define a switch attribute in the Union.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.