If I have a class Foo which extends class Bar, and an instance of Bar, is there anyway to use that instance of Bar to 'populate' a new instance of Foo?
Essentially, I am only able to retrieve Bar, but I want to use Foo in my code as it gives me lots of additional methods.
I saw quite a few solutions come up to similar questions but they all seemed to be python or c#.
I cant use ReflectionClass::newInstanceArgs as I cant access the data that went in to the constructor of Bar to create it in the first place.
Fooshould be able to construct itself from aBar, then you should add this functionality into theFooconstructor.