Interfaces are used to pass objects that are completely different but who all have some methods that are defined in the interface.
Consider a class Rock and a class House. Completely different, and nothing in common, almost. For instance, they both can drop down and crash, say in case of an earthquake :P. Now, you have a class Earthquake with a SmashObjects method. Instead of having to create a parent class for everything on earth that can drop, and have every class, like Rock and House inherit that class, you can make an interface IDroppable and have Rock and House implement that interface. In the interface you define Drop(); and now SmashObject can smash every object that implements IDroppable because it knows, no matter how different, they all have a Drop method.
interface IDroppable
{
Drop();
}
class House : IDroppable
{
Drop()
{
// do house dropping stuff
}
}
____________________________________________________
[url=http://www.visage-glasgow.co.uk/glasgow-tooth-whitening-scotland.html] Teeth Bleaching Glasgow[/url]|
[url=http://www.visage-glasgow.co.uk/glasgow-clear-braces-scotland.html] Invisalign Glasgow[/url]
proximity infotech 6
Ray.chayan, if this helps please login to Mark As Answer. | Alert Moderator