I have been playing around and am unable to explicitly cast an object
instance from one user-defined type to another, using the traditional
type-casting syntax nor with the settype() function.
I feel like I should mention this as an annotation in the man page, but
I was hoping someone could steer me right if I'm wrong here. The
following code doesn't work:
class Apple
{
// some atts and meths
function display() { // do something }
}
class Orange
{
// some atts and meths
function display() { // do something }
}
// this part works fine
$fruit = new Apple;
$fruit->display();
// this part doesn't work like you think it would
$newFruit = (Orange)$fruit;
$newFruit->display();
The confusing thing is that this page
http://www.php.net/manual/en/language.types.type-juggling.php
actually does feature casting to objects, but I am unsure of what
purpose the "object" type reference has.
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php