TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sarav
NA
1
0
Interfaces - Why we need them?
Aug 3 2004 8:55 AM
why do we need interfaces ... Suppose we have two interfaces like interface I1 { void display(); } interface I2 { void show(); } Suppose we implement these interfaces in a class as shown ... class ImplementInterfaces : I1, I2 { public void display() { Console.WriteLine("Display method in I1"); } public void show() { Console.WriteLine("show method in I2"); } } Suppose we have our program in a class like this ... class interfaceDemo { static void Main() { ImplementInterfaces obj = new ImplementInterfaces(); obj.display(); obj.show(); } } ---------------------------------------------------------------------------------------- my question is, if we are going to declare and define what the methods are going to do in our class only then why take the pain of declaring them in an interface? Why do we need an interface if we are going to declare and define our methods explicitly in our class? We might as well get rid of both the interfaces and declare and define the show() and display() method in the class itself. why we need interfaces in the first place. eagerly awaiting a reply for this. regards, Sarav
Reply
Answers (
3
)
Reverse lookup for label ctrl.
Reading multi level XML tags using VB.NET