Should there be two data types for the Parent and Child class in Java?

I have two classes Parentand Child.

class Child extends Parent {
    private String extraField1;
    private String extraField2;
    ...
}

Childthe class has 2 additional fields extraField1and extraField2.

Q1. Should I make two diff. tables in the data file: one for Childand another for Parent?

or

Q1. Add two columns to the table Parent(each column for one additional field) and save Childin the table Parent.

================================ =================== ==================================================== =======================

Yes, Childand Parentare classes in the same hierarchy.

+1
2

Java?

. , . .

2. : O/R, :

(...) , , . :

( , ) 2.6 .

, , , .

+10

, .

, . True Way, , .

:

  • . , , .
  • .
  • , .

:

  • .
  • .
  • , . , (285), , Single (278).
  • , , , .
  • , ( ).
0

Source: https://habr.com/ru/post/1733656/


All Articles