Test your technical skills online, appear in Virtual Interview and be ready for job!
Twitter Twitter LinkedIn YouTube Google
Be Interview ready ! | Search
Make friends on DotNetFunda.com and expand your network!
Winners

Win Prizes

Announcements
Like us on Facebook
Sponsor
Top Forums Author
Sat, 19-Apr-2014 Authors
Xilioner17
20
Riyazhaider
10
All Time Authors
Jayakumars
3930
Karthikanbarasan
3455
Chvrsri
3140

Latest members | More ...


(Statistics delayed by 5 minutes)

creating an object for interface

Priyajagan
Posted by Priyajagan under .NET Certifications on 7/26/2011 7:51:51 AM | Points: 10 | Views : 1642 | Status : [Member] | Replies : 2


Comments or Responses

Posted by: Jpchoudhari on: 7/26/2011 [Member] Starter | Points: 25

Hi,

You can not create object of Interface type as it contains only declination or implementation behavior.

Refer this:
http://msdn.microsoft.com/en-us/library/87d83y5b(v=VS.100).aspx
http://www.codeproject.com/KB/cs/cs_interfaces.aspx

Kind Regards,
Jay

Priyajagan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kadhababu on: 7/27/2011 [Member] Starter | Points: 25

You can't create an object without method implementations. Anonymous inner classes allow you to do the following, though:

view plaincopy to clipboardprint?

public interface MyInterface {
public void myMethod() ;
}

...

MyInterface myIntfObj = new MyInterface() {
public void myMethod() {
....
}
};

myIntfObj.myMethod();


http://www.cegonsoft.com/dotnet.phpDot Net Training

Priyajagan, if this helps please login to Mark As Answer. | Alert Moderator


Login to post response.

Comments / Responses
Select text & click toolbar to format. Formatting appears in viewmode only. HTML Tags are not allowed.
Bold Italic Underline Paragraph Title Code  Link 
 Wait ... Processing ..... please wait.

Found interesting? Add this to: