Can you take a subclass object and somehow convert it to an object of the same type as the parent class and at the same time slicing all the fields that are not part of the parent class?
I know you can do this in C++, but I have no idea how to do it in Java.
Try this:
Then you can do something like
Parent parent = new Parent(child);and you will achieve the desired result, but as others commented this won't be a conversion but rather construct an entirely new object.