+ 1
Whats the point if you need to override all the methods insde the interface ?
2 ответов
+ 1
it defines the things the new class needs to have. it's great for making sure things conform to standards. you can use an interface to implement an API or way of communicating.
this way, if you know a class implements the interface "CRUD" for example, and you define the CRUD interface to have 4 methods: Create, Read, Update, Delete, well now, you know any class that implements your CRUD interface will have the proper methods you want it to. Now the compiler can check and make sure you did what you meant to do.
0
This is the gentleman agreement between interface and implemented classes, we have to provide basic needs for the classes, This like satisfying govt rules on private firms using their own capacity, like if you want to use my services you have to follow my rules..