Interfaces multiple choice question

Given an interface named IWriteable, what type of object can be passed to the method with the following declaration? public bool Save(Iwriteable obj)

      a.       any object  
      b.       any object that implements the IWriteable interface  
      c.       any object that implements the Save method  
      d.       only objects created from the IWriteable class  
Who is Participating?
mrsreerajConnect With a Mentor Commented:
 b.      any object that implements the IWriteable interface  
This is obviously a homework question man... We can't just answer questions like this!

Oh, btw, it's E
igor92128Author Commented:
Its 500 points, dude.
JoeisanerdConnect With a Mentor Commented:
When you create an interface and pass it as a parameter you are basically setting up a contract saying that you will guarantee that the object being passed it will have methods with known signatures and properties that have to be there, whether fully implemented or not.

What would it be any object? the compiler will stop you with that one. C is just plain retarded.

So any object that implements the interface would work, which also means any object created from the object.  Interfaces don't create objects, objects only implement them.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.