6:40 AM
I, the class who implements interface IYetAnotherInterface, vow to implement everything that is declared in this interface and made it part of mine interface.
So, in other words, if a class implements some interface(in general sense, but in C# that would be those types that declared as interface)
it just tells everyone that it ready to serve any call that declared in this interface
actually, not the class, but it's objects.
so, API is more general in that sense and it's still a contract.
When we say Plugin API we can mean two things:
API which plugins must implement and API which core program provides for plugins.
Both are contracts. Both declares the way of communication.
And now, to most useful part. How the hell do plugins work?
By core I will mean program that loads up plugins
In the core we define interfaces that our plugins must implement - so, we could work with them and make some calls to it.
In the plugins, we get those interfaces (in case of C# - referenced corde DLL for example)
Now, when our core program is running and it knows it wants some specific plugin(because we said so, say, in configs)
It will search for it in order to load this.
In case of C# it would be DLL, I suppose. (yeah, actually, we can do whatever we want and use plugins written in another language and interpret/compile them after loading. Examples: lua.)
so, Core program finds and loads this DLL to it's memory. You got something like a handle to this DLL. So, via this handle you would ask to create an object of this type(your interface types from core) with this arguments for constructor.
And voila! You've got yourself an object from this dll.
You don't know what it is, but you know that it implements this interface
And you can work with it.
That's actually the point of interfaces.