1

Something like this:

public class Type
{
  //code
}

public class TypeA extends Type
{
  //code
}

public class TypeB extends Type
{
  //code
}

I want to create a third class named Type C that includes all values of both Type A and B.

For example, lets say that both Type A and B have two values and I want to make something like this in the main class:

Type c = new TypeC(TypeA(value, value), TypeB(value, value));
papercvt
  • 11
  • 2
  • 1
    We would have to write `... new TypeC(new TypeA(...), new TypeB(...))`. --- We can define a constructor `public TypeC(TypeA typeA, TypeB typeB) { ... }` on class `TypeC`. – Turing85 May 10 '21 at 16:40
  • oh this was more obvious than I thought Thank you so much!! – papercvt May 10 '21 at 16:42

0 Answers0