MrCzeal February 2016

What design pattern is simple inheritance in Java?

I've recently read some concepts in OOP (yes, I'm a noob) and one of the concepts I read is Design Patterns. I've checked most of the patterns and a question struck me:

What's the name or term of such pattern that would simply inherit/extend an abstract class or any class to such matter? Or is it not even a design pattern?

e.g. Abstract Class Drink, Class Juice extends Drink, Class Soda extends Drink etc.

Answers


JaeYeoul Ahn February 2016

Inheritance is not a design pattern. Inheritance is one of the way to making design pattern. if you can understand Decorator pattern, You will be able to understand that why we use inheritance in java OOP. How about check this website : https://en.wikipedia.org/wiki/Decorator_pattern


aribeiro February 2016

It's not a pattern, it's just Inheritance, as stated in the Java docs here.


Raedwald February 2016

As other answers have said, inheritance is not a design pattern: it is just inheritance.

Are you actually asking whether there is a design pattern that uses just a single class hierarchy, using just inheritance and not composition? There is such a design pattern: the Template Method pattern.


davioooh February 2016

I'm not sure to understand your question... but the "simplest" design patterns, that come to mind, based on simple inheritance are Strategy pattern and Template pattern.

Take a look.

Post Status

Asked in February 2016
Viewed 1,780 times
Voted 12
Answered 4 times

Search




Leave an answer