S
S
s2019-03-26 15:44:24
Java
s, 2019-03-26 15:44:24

How to correctly convert / cast one heir to another?

I'm interested in this question: how can one cast one heir to another, if the first, unlike the second, has a collection with its own type, and the second does not have a collection, but has its own overridden toString ()
As you know - convert from heir to parent it is possible because there is a common signature and allocated memory for the heir, and there is still a "remainder" during casting.
But how can one convert from a parent to an heir?
The option with the intersection of common fields from the heirs does not suit me, since it seems to me that this is redundant work and it is possible to do everything much easier and more concisely.
PS I would be glad for any help, as well as comments on this issue.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Elmo Sputterspark, 2019-03-26
@Sputterspark

No way. Borzoi and pug are both the heir of the wolf, but it is impossible to drive a deer with pugs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question