On 8/24/06, Mark J. Reed <[EMAIL PROTECTED]> wrote:
On 8/24/06, Luke Palmer <[EMAIL PROTECTED]> wrote:
> Well, actually Array would be a subtype of Array::Const, not t'other
> way round.
Why? That makes no sense to me. An Array isn't a variety of
constant Array; a constant Array is a variety of Array...
Let's say our arrays are simple, for argument's sake: With a constant
array, you can:
* get its length
* get the value of an element at an index
With an array, you can:
* get its length
* get the value of an element at an index
* set the value of an element at an index
That is, arrays have strictly more capabilites than constant arrays.
Every array can be used as a constant array, but not every constant
array can be used as an array.
You can see this recognized in C++:
int* x;
const int* y;
x = y; // illegal
y = x; // okay
Luke