Re: Class question

From: Date: Fri, 15 Sep 2006 09:09:11 +0000
Subject: Re: Class question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241813@lists.php.net to get a copy of this message
Use 'extends' syntax for sub classes class A { var $some_var; var $class_B; function A(){ $this->class_B = new B(); $this->some_var=2; } } class B extends A { var $class_C; function B(){ $this->A(); $this->class_C = new C(); // $this->some_var= some_var_from_class_A; <-- $this->some_var contains the value allready } } class C extends A { function C(){ $this->A(); // $this->some_var= some_var_from_class_A; <-- $this->some_var contains the value allready } } on Friday 15 September 2006 11:01, Roger Helgesen wrote: > I have 3 classes, CLASS A,B and C > > class A { > var $some_var; > var $class_B; > function A(){ > $this->class_B = new B(); > $this->some_var=2; > } > } > > class B { > var $some_var; > var $class_C; > function B(){ > $this->class_C = new C(); > $this->some_var= some_var_from_class_A; > } > } > > class C { > var $some_var; > > function C(){ > $this->some_var= some_var_from_class_A; > } > } > > > > How can class B and C get the value of $some_var_class_A without using > "$this->class_B = new B($some_var);" > > > roger helgesen

« previous php.general (#241813) next »