Pages

Wednesday, April 2, 2014

How interfaces avoid “Deadly Diamond of Death” problem?

A key difference between interface and abstract class is, “Interfaces simulate multiple inheritance” for languages where multiple inheritance is not supported due to “Deadly Diamond of Death” problem.

How interfaces avoid “Deadly Diamond of Death” problem?

Since interface methods do not have their underlying implementation, unlike the inherited class methods, there won’t be this problem as there can be multiple method signatures that are same, but there can be only one implementation for a particular class instance as duplicate methods cannot be compiled without any errors.

Reference:
Head First Java

No comments:

Post a Comment