DayType =(dtWorking,dtWeekend,dtHoliday);
MyCalendar = class
private
function GetCurrentDayType:DayType ;
public
property CurrentDayType:DayType read GetCurrentDayType;
end;
function MyCalendar.GetCurrentDayType:DayType;
begin
result := dtWorking;
end;
java代码:
1
final class DayType
{
2
3
public static final DayType WORKING = new DayType();
4
5
public static final DayType WEEKEND = new DayType();
6
7
public static final DayType HOLIDAY = new DayType();
8
}
9
10
public class MyCalendar
{
11
12
public DayType getDayType()
{
13
return DayType.WEEKEND;
14
}
15
16
}
17

final class DayType
{2

3
public static final DayType WORKING = new DayType();4

5
public static final DayType WEEKEND = new DayType();6

7
public static final DayType HOLIDAY = new DayType();8
}9

10

public class MyCalendar
{11

12

public DayType getDayType()
{13
return DayType.WEEKEND;14
}15

16
}17
