adding method to check if a class can be instantiated