implemented the begin and end member functions of array