0

what is the concept of interface? and what is use of it?

please give me with examples

21st Sep 2016, 4:41 PM
venkata veerendra manikumar kancharla
venkata veerendra manikumar kancharla - avatar
2 odpowiedzi
+ 1
It's some kind of contract. Interface includes methods signatures and force classes implementing this interface to implement all methods which are declared in the interface.
21st Sep 2016, 5:52 PM
Dima Nagaev
Dima Nagaev - avatar
+ 1
interface ICreature { void speak(); void drink(); bool isAlive(); } public class Human : ICreature { public void speak() { //implementation } public void drink() { //implementation } public bool isAlive() { //implementation } }
21st Sep 2016, 5:59 PM
Dima Nagaev
Dima Nagaev - avatar