Update DepthOfInheritance.php

Implemented TryCatch for OutOfBoundsException