Is there an easy way to recast a parent object as a child class, preferably by a method of the parent class.
For instance I may have a “Visitor” class and “Member” class which extends “Visitor”. Upon success of the authentication method is it possible to recast the object?
Thanks
You can define a constructor in the
Visitorclass which would take anotherVisitorobject and copy all the properties into the new object. Then this constructor will be inherited to theMemberclass and you will be able to create aMemberobject by copying an existingVisitorobject.