Posted by Kimmo Laine on 12/29/06 11:46
"CorfuVBProgrammer" <merianosnikos@gmail.com> wrote in message
news:1167390903.553328.37000@48g2000cwx.googlegroups.com...
> Hello all . . .
>
> I need a help for something simple.
>
> I have create two php classes
>
> for example
>
> class classname_1
> {
>
> }
>
> and the
>
> class classname_2
> {
>
> }
>
> if i like to make an instance of class classname_1 into the classname_2
> how can i do it ? ? ?
>
> I have try to make one like
>
> class classname_2
> {
> $obj_class1 = new classname_2();
> }
>
> but it doesn't work ! ! ! !
>
> Why ? ? ?
>
> Thanks a lot . . . :D
I'd do it like this:
class A {
}
class B {
private $my_object;
public function __construct(){
$this->my_object = new A();
}
}
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)
[Back to original message]
|