Hi
I would like to know wheather interfaces can be instantiated or not.I know interface definition can not have any constructor.so they can't be instantiated.
but i see many places where the syntax seems like they are instantiating the interface.
e.g:
IEnumerator e =names.GetEnumerator();
Note that the GetEnumerator() method returns an enumerator object each time it is called.
so what is this "e"? plz clarify this one line of code.
thanx
Techy WizardPosted Jul 22, 2008, 4:25 AM
The GetEnumerator method returns a reference of the IEnumerator interface.
So, at no point of time can you create "an object" of an interface.
In the line, "IEnumerator e= names.GetEnumerator", e is just reference of the interface, not an object.