public class AddrBook
{
// internal variable to hold the bookList
private ArrayList bookList;
// outsiders may access the list with the Book property
public ArrayList Book
{
get { return bookList; }
private set { bookList = value; } // <-- if we provide a protected or
// private setter then we can set it
// using the property inside the class,
// but the property would still only be
// 'gettable' for ousiders.
}
public AddrBook(Addr addr)
{
Book = new ArrayList();
Book.Add(addr);
}
AddrBook ab = new AddrBook();
ab.Book.Add(addr);
ab.Book = new ArrayList(); // <-- WRONG!!!!