You are here: Re: HELP ! ! ! something simple . . . :D « PHP Programming Language « IT news, forums, messages
Re: HELP ! ! ! something simple . . . :D

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)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация