Why do we need Interface..? Where is it used exactly in real time scenario's .?
Could you please explain anybody.
Thank you.
Regards,
Madhu.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Burak SeyhanPosted Nov 19, 2013, 9:19 AM
VulpesPosted Nov 19, 2013, 9:53 AM
Consider the following example. The classes Square and Cube both implement the IPower interface but otherwise are not related in any way.
This enables us to write a method (MyMethod) which works with any object which implements the IPower interface:
The output is:
4
8
madhukar avunooriPosted Nov 19, 2013, 9:37 AM
Could you please explain with examples.?
Burak SeyhanPosted Nov 19, 2013, 9:19 AM