How can I assign and invoke a member function to an array element?