Reactions to story from MICROSOFT DOT NET TIPS,TRICKS,INTERVIEW QUESTIONS
Casting to an Interface in c sharp
http://dotnetpoint.blogspot.com/ 2008/ 05/ casting-to...
You can access the members (i.e., methods and properties) of an interface through the object of any class that implements the interface. Thus, you can access the methods and properties of IStorable, through the Document object: Document doc = new Document("Test Document"); doc.status = -1; doc.Read(); When you cast you say to the compiler, "trust me, I know this object is really of this type." In this case you are saying "trust me, I know this document really implements IStorable, so you can treat it as an IStorable." Casting is safe to do because the Document object implements IStorable and thus is safely treated as an IStorable object.
More rising blog posts
More rising news stories
-
Business »
Unemployment Claims Crash System -
Lifestyle »
Milky Way is bigger than thought, study says -
Politics »
Army Apologizes For "John Doe" Letters -
Technology »
Study: Black holes seem to form before galaxies -
Entertainment »
Maksim Chmerkovskiy Gushes About New Fiancée -
Sports »
Derby 1-0 Man Utd
Recent posts from MICROSOFT DOT NET TIPS,TRICKS,INTERVIEW QUESTIONS
-
Dot net FAQ's on Manifest and Assemblies
196 days ago -
DOT NET FRAME WORK FAQ ONE
199 days ago -
HR QUESTIONS FOR DOT NET INTERVIEW
200 days ago

