Assume "IClass" is an interface and "MyClass" implements it. What's the difference between the following 2:
1) IClass c = new MyClass();
2) MyClass c = new MyClass();
Also what's the purpose of casting to interfaces like this (taken from an app with Spring.NET framework):
ICultureConfigurationManager cultureConfigManager =
(ICultureConfigurationManager)SimpleObjectFactory.getObject("cultureConfigManager");
My understanding from the above is that, it creates an instance of ICultureConfig... and then assigns it to some object from the SimpleObjectFactory class which has been casted to the ICultureConfig... interface. Anyway, I don't understand how casting to an interface works and how useful it is.
Finally what's the difference between using the above method to cast to interfaces and using the "as" keyword
Thanks.