note 4492 deleted from Classes and Objects by ronabop

From: Date: Thu, 17 Aug 2000 09:57:18 +0000
Subject: note 4492 deleted from Classes and Objects by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-2158@lists.php.net to get a copy of this message
Does anyone know how to make casting to user-defined classes. For example, if I have a parent class call "Parent", and I instantiate it at design time, and I'll cast it to one of the child classes (say "Child1" which certainly inherit from "Parent") by some machanism (design pattern in OO sense). I tried the following: <Pre> $parentobj = new Parent(); $childobj = (Child1) $parentobj; </Pre> It didn't seem to work for me, I'm using PHP Version 3.0.15 on Linux RedHat platform. I reckon that a significant feature OO Design, if PHP don't have it right now, I hope someone (who working on PHP) will recognise this in the future. Thanks to everyone pay attention this. Best Regard Max

« previous php.notes (#2158) next »