Null references redux

language_fan foo at bar.com.invalid
Sat Sep 26 15:20:44 PDT 2009


Sat, 26 Sep 2009 17:59:45 -0400, Jeremie Pelletier thusly wrote:

> How would you do this then?
> 
> void foo(int a) {
> 	Object foo;
> 	if(a == 1) foo = new Object1;
> 	else if(a == 2) foo = Object2;
> 	else foo = Object3;
> 	foo.doSomething();
> }

I just LOVE to see questions like these ;) You still have SO much to 
learn. Go grab the 'purely functional data structures' by chris okasaki 
from the nearest library and try how many pages you can read before your 
head explodes. No, it is a purely enlightening process actually :)



More information about the Digitalmars-d mailing list