0

Why do i get an error initializing an IContainer. IContainer cont = new IContainer();

25th May 2017, 10:03 PM
DoubleVermine
DoubleVermine - avatar
9 Respostas
+ 6
I don't know what's with all the down votes, but like @Mr Programmer mentioned, IContainer is an interface. .NET uses the "I" prefix convention to indicate this. The reason you can't instantiate an interface is because it doesn't have an implementation. Classes derived from from the interface provide the implementation, which is the purpose of interfaces-- It provides a common means of interaction amongst various container classes.
25th May 2017, 11:04 PM
Squidy
Squidy - avatar
+ 4
@Squidy you are right someone hates me.
25th May 2017, 11:30 PM
MR Programmer
MR Programmer - avatar
+ 3
interface can be initialized like this. example interface test{ //...... code } class a:test{ ///.... code } test cont = new a(); you cannot write this test cont = new test();
25th May 2017, 10:17 PM
MR Programmer
MR Programmer - avatar
+ 3
its similar to inheritance
25th May 2017, 10:33 PM
MR Programmer
MR Programmer - avatar
25th May 2017, 10:07 PM
MR Programmer
MR Programmer - avatar
+ 2
btw it wasnt me my phone doesnt even allow me to give thumbs up or down and says no connection when i press them.
25th May 2017, 11:33 PM
DoubleVermine
DoubleVermine - avatar
+ 1
Yup but I dont know how use it not how to create it if you dont mind helping me i would really appreciate it.
25th May 2017, 10:09 PM
DoubleVermine
DoubleVermine - avatar
+ 1
is a the inheritence
25th May 2017, 10:20 PM
DoubleVermine
DoubleVermine - avatar
+ 1
okay i sees now
25th May 2017, 10:38 PM
DoubleVermine
DoubleVermine - avatar