Well, that's where I'm getting confused: A constant is a static value within a domain. For instance,
2 is a static value in the
integer domain, whereas the integer variable
i is not.
A class plays a dual role. It is a type definition AND a static value within the domain defined by the class of type. Consider the following parallel:
Type
TMyBook = class end;
TMyLongBook = class(TMyBook) end;
TMyShortBook = class(TMytBook) end;
TBookClass = class of TBook;
DaysOfTheWeek = (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
Monday ...
Sunday are static values within the
DaysOfTheWeek domain. In a similar vein,
TMyBook,
TMyLongBook and
TMyShortBook are static values (constants) within the TBookClass domain. There's a logical consistency when viewing these things this way. After all, once a class is defined, it can't be changed within the program's run-time. It's a _constant_
So, why is the compiler treating it as something other than a constant __within the context of
TBookClass? I don't get it.