PHP Classes: parent/child communication

Posted by Fffff on Stack Overflow See other posts from Stack Overflow or by Fffff
Published on 2010-05-03T21:21:25Z Indexed on 2010/05/03 21:28 UTC
Read the original article Hit count: 189

Filed under:
|
|
|
|

Hi all,

I'm having some trouble extending Classes in PHP. Have been Googling for a while.

 $a = new A();
 $a->one();

 $a->b1();
 // something like this, or...

 class A {
  public $test1;

   public function one() {
    echo "this is A-one";

    $this->two();
    $parent->two();
    $parent->B->two();
    // ...how do i do something like this (prepare it for using in instance $a)?

   }
 }

 class B extends A {
   public $test2;

    public function two($test) {
     echo "this is B-two";

    }
 }

I'm ok at procedural PHP.

© Stack Overflow or respective owner

Related posts about php

Related posts about class