instances method to get all instances of a given class.