jeudi 28 avril 2016

how to create less specific class from another class in java

I have a model class A { int a ; int b; int c;} I want to create new class B {int a;int b;} I don't want to rewrite all attributes in class B ,this attributes is already written in A . How to use A to create B . we can add extra features to class with extends but how create less specific class ? . are there any pattern for this ? how should be class A or class B or other polymorphic classes. (i want to use class B for inserting db , model class and db table should be same) Sorry for my poor english

Aucun commentaire:

Enregistrer un commentaire