+ 1

What is the use of interface as the same methods are defined on another class and only the declaration happens in interface?

I think it is not needed since we can declare a method directly without using interface. If any other hidden concepts of interface are available please clarify me.

21st Apr 2018, 6:17 AM
அபிஷேக் அபி
7 ответов
+ 2
Because you can do IExample foo = new ExampleImpl1(); foo = new ExampleImpl2();
21st Apr 2018, 7:28 AM
Timon Paßlick
+ 2
Sure it has. For example, you could do IConnection or something like that.
21st Apr 2018, 7:41 AM
Timon Paßlick
+ 2
You can define IConnection as an interface for different kinds of internet connections.
21st Apr 2018, 8:03 AM
Timon Paßlick
+ 1
please read my question clearly
21st Apr 2018, 6:50 AM
அபிஷேக் அபி
+ 1
i think this may not have required advantages
21st Apr 2018, 7:40 AM
அபிஷேக் அபி
+ 1
Iconnection means???
21st Apr 2018, 8:02 AM
அபிஷேக் அபி