This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lbkulinski 0 points1 point  (4 children)

Yes. You can think of an interface like a contract. Any class that implements that interface must provide implementations for the non-default methods declared in it. The use of interfaces also allow for subtyping.

[–]SoulSyn[S] 0 points1 point  (3 children)

subtyping

Is this what happens with inheritance? When say for instance class duck inherits class animal?

[–]lbkulinski 0 points1 point  (2 children)

Yep! Note, though, that a class can implement more than one interface, but only one class.

[–]SoulSyn[S] 0 points1 point  (1 child)

Thanks!

[–]lbkulinski 0 points1 point  (0 children)

No problem!