+ 7
How would you apply an interface in a real world scenario?
I understand the concept and mechanics of an interface, but how would one use an interface practically?
5 Réponses
+ 6
What I'm asking is, how does an interface benefit a project as opposed to an abstract class for example?
+ 5
so the attributes and methods are defined in an interface and implemented by a class? Or can they be implemented anywhere?
+ 4
oh now i understand
the two are not really to
be compared with
abstract prevents instanciation
of the class
might be good for inheritance
where you don't want to
instantiate the superclass
interface allows different entities,
besides inheriting, to have extra
attributes / methods
+ 4
interfaces meth can be used in a class
+ 3
can you please elaborate?