Hey,
I have the following codes:
// In Form1.h
protected:
ItemGroup^ History;
ItemGroup^ Favourites;
// In Form1(void)
History = (gcnew ItemGroup());
Favourites = (gcnew ItemGroup());
// ItemGroup
public:
ItemGroup(void);
int Length() { return _length; }
Item^ Items(int _index) { return _items[_index]; };
void Add(String^ _text)
{
for (int i = _length; i < 0; i--)
{
_items[i] = (gcnew Item());
_items[i] = _items[i - 1];
}
if (_length < _maxlength)
_length++;
_items[0] = (gcnew Item());
_items[0]->Text(_text);
}
void Delete(int index)
{
for (int i = index; i < _length; i++)
_items[i] = _items[i + 1];
_length--;
}
private:
static const int _maxlength = 8;
static int _length = 0;
static array<Item^>^ _items = gcnew array<Item^>(_maxlength);
};
// Item
public:
Item(void);
String ^ Text() { return _text; }
void Text(String ^ value) { _text = value; }
private:
String ^ _text;
Both History and Favourites are treated as the same object. They both have exactly the same items, length and everything. I do one thing to one, the other one updates too. What could be causing this?
Thanks and sorry for the masses of code (I tried to trim it).