Re: [PHP4BETA] Classes broken?

From: Date: Mon, 15 Nov 1999 16:58:12 +0000
Subject: Re: [PHP4BETA] Classes broken?
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-6253@lists.php.net to get a copy of this message
: > class Class1 : > { : > var $myvar; : > var $childclass; : > } : > : > class Class2 : > { : > var $age; : > var $name; : > var $etc; : > } : > : > $mainthread = new Class1; : > $mainthread -> childclass = new Class2; : > $mainthread -> childclass -> age = "1241"; : > : > The Class2 is useless in the above case. : : This should work... You didn't get my point. class Class1 { var $myvar; var $childclass; } class Class2 { var $age; var $name; var $etc; } $mainthread = new Class1; $mainthread -> childclass -> age = "1241"; print $mainthread -> childclass -> age; Does the same thing, so there is no class into class rule. : > Also, I would like to know if there is a quick and easy way : > to determine what "class" the variable is associated to? : > PHP is an interpreted language, and it think it does (or should?) : > allow this. : : Here are some fun zend functions: : : get_class($object) - get classname : get_parent_class($object) - get parent classname : method_exists($object, "classname") - check if classname exists in $object Thank you! That _might_ come handy at places. -- Faisal Nasim (the Whiz Kid) Web: http://wss.hypermart.net/ FAX: (815) 846-2877 AOL IM: Whiz Swift

« previous php.version4 (#6253) next »