can we give the restriction to method for a particular class