Open RMHogervorst opened 1 year ago
Sorry, I don't think you can do this. When you call $new()
, it always returns an instance of the class that $new()
is called on.
Why not just call childclass$new()
?
Yeah I was afraid of that.
why not just call childclass$new?
Thanks!
I have a base class with a initialize function. What I'd like to do is for that initialize function to create and return a child class ( a class that inherits from the base class.)
Unfortunately this does not work, I get the baseclass only back.
Right now I have to create a function that instantiates a class but it would be so much cleaner if that could happen from the baseclass.
Is this possible?