public void SomeMethod(object myParam) { myParam.SomeOtherMethod(); }The type "object" doesn't have a "SomeOtherMethod" method. OK, now what? Well, you could jump through a lot of hoops and use reflection to make the method call for you. But it's a lot of work. In VFP code like that is perfectly valid - I can pass any object type into a method like that and access any properties or methods and VFP doesn't care. If the object doesn't have those properties or methods it will just blow up at runtime. I'm a good developer so I won't pass in something that would blow up. .NET sucks - it makes things so difficult.
FUNCTION SomeMethod(toParam)
toParam.SomeOtherMethod();
ENDFUNC
So now what? I can't do what I'd like to do in .NET. That's where interfaces come in. You define the methods/properties that a class must implement in the interface. Then you use the interface as the parameter type instead. You "inherit" from this interface for every class type that you are going to be passing into this method. You can inherit multiple interfaces on a given type giving your class the cameleon-like ability of appearing as exactly the right type to methods, regardless of what class it really inherits from. So we can rewrite the above code:public interface ISomeInterface { void SomeOtherMethod(); } public void SomeMethod(ISomeInterface myParam) { myParam.SomeOtherMethod(); }Now assuming the object I pass into SomeMethod implements the ISomeInterface interface, all is well. You get compiler-time checking to make sure things don't blow up, Intellisense works, etc.