ankita modi. wrote:I have a design pattern question from 804 exam.I searched on Google as well as explored referred head first design pattern book, but didn't found any help.I know pretty enough about interface inheritance and class inheritance, but i am looking explanation in context of design pattern,if anyone knows about it ?
Well, assuming that last sentence is your question, then my answer would be: in general, choose interface inheritance.
Why? Here are just a couple of reasons:
1. Class inheritance imposes a lot of restrictions on subclasses and must be designed
and documented carefully.
2. In
Java, class inheritance is one-to-many (ie, a class can only extend
one parent); interface inheritance is many-to-many.
HIH
Winston