PM>> <?php
PM>>  class Root {
PM>>   class Nested {
PM>>    function Nested() {
PM>>     print("Root::Nested constructed\n");
PM>>    }
PM>>   }
PM>>  }
PM>> 
PM>>  class Child extends Root {
PM>>   class Nested {
PM>>    function Nested() {
PM>>     parent::Nested();
PM>>     print("Child::Nested constructed\n");
PM>>    }
PM>>   }
PM>>  }
PM>> 
PM>>  $object = new Child::Nested;
PM>> ?>
PM>> 
PM>> If you attempt to execute this script with the PHP 4.3.0 ZE2 alphas (either
PM>> 1 or 2), you'll get a fatal error specifying that "Cannot fetch parent:: as
PM>> current class scope has no parent", referring to the Child::Nested
PM>> constructor and the "parent::Nested();" line. Is the outer classes just

But the Child::Nested class doesn't have parent indeed! Child has parent, 
but Child::Nested doesn't. 

PM>> meant to be for namespacing purposes? Any class deriving from the
PM>> parent will not have its nested classes derive from the parents
PM>> nested classes. So then why can't nested classes be extended from
PM>> anything? Just some symbolism: P is parent, defines P.n is nested, D

It can. You can use "extends" in nested class, AFAIK, just as you do in 
plain one - just interitance is not inherited (brrr... what a messy 
phrase) by the nested classes.

PM>> extends P, defines D.n nested, yet D.n has no relation to P.n and is
PM>> not allowed to extend it explicitly (wouldn't it be implicit, with

You definitely can do it explicitly - by saying "extends Root::Nested" in 
Child::Nested.

-- 
Stanislav Malyshev, Zend Products Engineer   
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.109




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to