What is better practice: force user to extend abstract class or make class with configuration? Eg. pseudocode:
ClassA{
this.name
this.weight
this.height
this.width
constr(config){
this.name = config.name
this.weight = weight
this.height = height
this.width = width
}
}
or
abstract ClassA{
this.name
this.weight
this.height
this.width
}
ClassB extends ClassA{
this.name = 'Item'
this.weight = 12
this.height = 11
this.width = 14
}
Until now i was using configuration because most libraries use this method, but whats wrong with second method? I recently found that method with extending is producing clearer code but maybe I am missing something?