I am currently teaching a colleague .Net and he asked me a question that stumped me.
Why do we have to declare?
if var is implicit typing, why do we have to even declare?
Animal animal = new Animal();
var animal = new Animal();
animal = new Animal();
The implicit typing would still mean that this is a statically typed variable.
If two different types are assigned to the variable, if they do not share a base class, (other than object), that could be a compiler error.
Is there a technical reason this could not be done or is it stylistically we like havein