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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Burak SeyhanRank #1,914 · 768 reputationPosted Nov 19, 2013, 4:19 AM EST
Burak SeyhanRank #1,914 · 768 reputationPosted Nov 19, 2013, 4:19 AM EST
madhukar avunoori28 reputationPosted Nov 19, 2013, 4:37 AM EST
Could you please explain with examples.?
VulpesRank #55 · 29.2K reputationPosted Nov 19, 2013, 4:53 AM EST
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