[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

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  
2 Solutions
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.
 b.      any object that implements the IWriteable interface  
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.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now