Is this valid code given getDog returns either a (Object)Dog or (Object)null ? It makes my code so much easier if so
C#:
public Object getDog() {
.......
if (noDogsFound) {
return null;
}
}
....
Dog dog = (Dog) getDog(); // casting a null object to type Dog
if (dog != null) {
...dosomething();
}