PHP Equivalent of Java Type-Casting Solution
Posted
by stjowa
on Stack Overflow
See other posts from Stack Overflow
or by stjowa
Published on 2010-03-07T23:40:33Z
Indexed on
2010/03/07
23:53 UTC
Read the original article
Hit count: 474
Since PHP has no custom-class type-casting, how would I go about doing the PHP equivalent of this Java code:
CustomBaseObject cusBaseObject = cusBaseObjectDao.readCustomBaseObjectById(id);
((CustomChildObject) cusBaseObject).setChildAttribute1(value1);
((CustomChildObject) cusBaseObject).setChildAttribute2(value2);
In my case, it would very nice if I could do this. However, trying this without type-casting support, it gives me an error that the methods do not exist for the object.
Thanks,
Steve
© Stack Overflow or respective owner