how can we call one class's method through another class's object in php

Posted by hello on Stack Overflow See other posts from Stack Overflow or by hello
Published on 2010-05-10T06:58:09Z Indexed on 2010/05/10 7:04 UTC
Read the original article Hit count: 207

Filed under:
|

I want to know that is there any method in PHP by which i can call one class's method from another class object. let me clear here is one class

    class A() {
    public function showData(){
        //here is method of class A
   }
}

 // here is another class

class B(){
      public function getData(){
            //some method in class B
         }
}

  //now i create two objects

$objA= new class A();
$objB=new class B();

now i want to call this
$objB->showData();<---

is that possible .. by any how method( using public, inheritence,child parent etc...) please help me

© Stack Overflow or respective owner

Related posts about php5

Related posts about oops