From Appmethod Libraries
Jump to: navigation, search

Object Pascal

property Bits[Index: Integer]: Boolean read GetBit write SetBit; default;


__property bool Bits[int Index] = {read=GetBit, write=SetBit/*, default*/};


Type Visibility Source Unit Parent
property public
System.Classes TBits


Provides indexed access to the array of Boolean values that the TBits object represents.

Use Bits to read or set a particular Boolean value, as indexed by the Index parameter. If Index is not in the range from 0 to Size - 1, an EBitsError exception is raised while trying to read the storage space. Otherwise, writing an Index bigger than Size-1 extends the storage space without error.

Note: In Object Pascal, Bits is the default property for TBits. This means that the property name can be omitted in code. That is, the statement:

My BitsObject.Bits[0];

can be written:

My BitsObject[0];

Note: In C++, Bits can be accessed using the [] operator. Doing so, you achieve an effect similar to the one of the default property in Object Pascal.

See Also

Code Examples