Sunday, July 12, 2009

Delegate or Interface?

How can you know where to use abstract and where to use interface ?Please give me an example in C#.NET?

Delegate or Interface?
u can't have multi inheritance in c#.


that time u can use interface.


Abstract classses cannot be instantiated directly, and have to implement.
Reply:Take human class as an example.. all the human will have 2 legs.. so, this can be implemented by abstract human class.. but behavious() cannot be same for all human.. at this time, the one who is gonna inherit this should implement it...
Reply:Same idea of abstract class and interface as Java.





As for delegates that term is exclusive to C# but better no-frill name is callback function.


No comments:

Post a Comment