#include <vcl.h>
#include <stdio.h>
#include <conio.h>
#pragma hdrstop

class Students
{
 public:
   Students(){}   // konstruktor klasy
   ~Students(){}  // destruktor  klasy
   __property AnsiString Name[int index] =
                             {read=GetName, write=SetName};

 private:
   AnsiString FName[4];
   AnsiString GetName(int index);
   void SetName(int, AnsiString);
} Person; //egzemplarz Person (osoba) klasy Students
//---------------------------------------------------------
AnsiString Students::GetName(int i)
{
  return FName[i];
};
//---------------------------------------------------------
void Students::SetName(int i, const AnsiString names)
{
   FName[i]=names;
}
//---------------------------------------------------------
int main()
{
  clrscr();
  Person.Name[0]="Wacek Jankowski"; // wywoluje Person::SetName()
  Person.Name[1]="Janek Wackowski";
  Person.Name[2]="Jola Lobuzinska";

  for (int i = 0; i <= 2; i++)
    puts(Person.Name[i].c_str());  // wywoluje Person::GetName()

 getch();
 return 0;
}

