Discriminated unions

Like structures, discriminated unions help as a valid type name in further declarations. They are followed by the type name and then the switch keyword, and they can take parameters of the type int/char/Boolean or enum:

. employee_dept {admin, sales, it, business};
union employee switch (employee_dept) {
case admin, business : age_spec age;
cae sales : sales_detail sales;
default float salary;
};
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset