In Jesse Liberty’s Programming C# (p.142) he provides an example where he casts an object to an interface.
interface IStorable { ... } public class Document : IStorable { ... } ... IStorable isDoc = (IStorable) doc; ...
What is the point of this, particularly if the object’s class implements the inteface anyway?
EDIT1: To clarify, I’m interested in the reason for the cast (if any), not the reason for implementing interfaces. Also, the book is his 2001 First Edition (based on C#1 so the example may not be germane for later versions of C#).
EDIT2: I added some context to the code
There is only one reason when you actually need a cast: When doc is of a base type of an actual object that implements IStorable. Let me explain: