A friend posted this on our New Zealand Dot Net mailing list.... I laughed my ass off so much that I just had to share (with permission it).
[When should I use interfaces in my code] I use them when I need a common API across dissimilar objects - a little bit like getting drunk eg, take the following 2 classes.. public class hotChick ... public class fatSlag ... Obviously, 2 quite different classes... however if we get good & drunk we can make them implement the same interface eg: public class hotChick : IShaggable ... public class fatSlag : IShaggable ... When programming against the interface you dont want to care about the actual implementation - getting drunk has the same effect... as long as the interface is the same you generally dont care... eg public void myMethod(IShaggable myShag){ myShag.ShagRotten(); ... ... as if by magic the fatSlag class, with a 10 pint handicap, all of a sudden appears to have some of the same properties and methods as the hotChick class [UPDATE} Lauren with the great comeback class SexistPig: ILonelyBastard ILonelyBastard TimHuffman = new SexistPig(); ILonelyBastard.Shaggable = false; Lauren
[When should I use interfaces in my code]
I use them when I need a common API across dissimilar objects - a little bit like getting drunk eg, take the following 2 classes..