what is the purpose of an Interface ?

Posted by Akiii under C# on 8/14/2011 | Points: 10 | Views : 2676 | Status : [Member] | Replies : 3
Hi,
Suppose, i have an interface A and i implement that in a class....

interface A
{
void show();
}

Class implementInterface: A
{
void show()
{
Console.WriteLine("dotnetfunda");
}
}



Now, if i have to define a method in a class then what is the purpose of declaring a skeleton somewhere else ?

Any help is appreciated.....
Thanks and Regards
Akiii




Responses

Posted by: Itorian on: 8/15/2011 [Member] Starter | Points: 25

Up
0
Down
As I know, C++ level languages has multiple inheritance features and in .net for the same we uses interfaces. This feature is not for small apps.

Student of M.Tech IT | Microsoft MVP | Mindcracker MVP | IT Faculty | Blogger | Author

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

Posted by: Akiii on: 8/16/2011 [Member] Bronze | Points: 25

Up
0
Down
@nitha...
Thanks for the links, specially the second and third one.

@Itorian....
Yes you are right.

I am depicting a scenario, please tell me how can i make use of an interface.
Presently i am working on a project which has Data Access Layer and Business Layer separated. in each of this layer, i have 10 classes respectively.
Now, how can i use interface in this ??

Any help is appreciated...

Regards
Akiii

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

Login to post response