RE: [PHP] extended class question

From: Date: Tue, 14 Sep 2004 00:35:35 +0000
Subject: RE: [PHP] extended class question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196582@lists.php.net to get a copy of this message
> Because test's var1 is private. > > test->var1 isn't accessible by class testing, so the assignment you're > doing in testing's constructor is assigning "Pizza Delivery" to > testing->var1 instead. > > When you call $test2->get_var1() you're calling the parent's get_var1() > method, which prints out the parent's var1 property. (which hasn't been > touched.) > > Change test's var1 to protected and it'll work. >

« previous php.general (#196582) next »