| Perfect Developer basic tutorial 2 | This page last modified 2011-10-29 (JAC) |
1. Given the following definition:
class TicketType ^= enum child, student, adult,
seniorCitizen end
which of the following expressions yield true ?
child@TicketType = lowest TicketTypechild@TicketType < adult@TicketType>adult@TicketType = seniorCitizen@TicketType>(>student@TicketType) = highest TicketType<child@TicketType =
seniorCitizen@TicketTypeAll except the last one are true. The last
expression violates the precondition of the unary <
operator, because child@TicketType has no predecessor.
2. Using the same definition as above, why are you likely to see an error
message if you use the expression student < adult
in a Perfect source file?
When you refer to the members of an enumeration class, you must qualify them
with the class name.
You probably meant to say student@TicketType
< adult@TicketType instead.
If you separately declared a variable,
constant or parameter called student and another
called adult , the expression might well be valid;
although reusing names in this way can be confusing and is not recommended.