inheritance - Method in parent class that returns child class in java -


i have parent class product , children class camera, tv, etc... want create method in product fetches db common attributes children , returns instance of child, according object fetched db (i have lot of children class). possible this? if yes, can show me little example?

my idea call method similar method in child class , fetching db non-common attributes.

i think should have @ decorator pattern

http://javarevisited.blogspot.co.uk/2011/11/decorator-design-pattern-java-example.html


Comments

Popular posts from this blog

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

node.js - Nodejs javascript implementation of PBEWithMD5AndTripleDES/CBC/PKCS5Padding -