500pts: Help on instantiating an object
Posted on 2006-05-11
I was reading over one of my c# books about instancing an object, which of course i already do... But i come across something puzzled me and wanted to know why.
Basically its an example in the book that states there are 2 classes. GenericCustomer and Nevermore60Customer (which inherits from base class Generic Customer).
It states to create an instance do the following :
GenericCustomer customer = new Nevermore60Customer();
That confused me, actually maybe i am going crazy but why can't you just do
Nevermore60Customer customer = new Nevermore60Customer();
why must you use GenericCustomer in front?? if you see my mean....
Can anybody clear this up for me?
Thanks in advance