Which design pattern to use - Java? -


i have 3 classes, a, b , c extend d. there methods common class a, b , c have put in d there methods common a , b, b , c , c , a. can add in layer of inheritance i.e create class e (put common methods a , b), d (put common methods b , c) , f (put common methods c , a) there design pattern relating this?

you try use composition instead of inheritance. create other classes , let a/b/c have references objects of these other classes. way more flexible anyway.


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -