$ Number of atomic bombs = 100;
Class atomic bomb {
Public $ raw materials;
Public $ production quantity;
Public Function _ construct ()
{
$ This-> raw material = "Uru 235 ";
}
Public Function mass production ()
{
Global $ Number of atomic bombs;
$ This-> production quantity = $ this-> production quantity + (RAND (10000,999 99 ));
Return $ Number of atomic bombs + $ this-> production quantity;
}
}
Class factory {
Public Function I create and create ($ object name)
{
Return new $ Object Name;
}
}
Class in Japan {
Public $ preparation;
Public Function _ construct ($ Number of atomic bombs prepared)
{
$ This-> prepare = $ number of prepared atomic bombs;
}
Public Function attack ()
{
Echo "Just listen to the bang, China will". $ this-> prepare. "The Hot atomic bomb is still in every corner of Japan! ";
}
}
/* Test by myself */
$ Atomic bomb factory = Factory: I create an atomic bomb ("atomic bomb ");
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Current number of atomic bombs = $ atomic bomb factory-> batch production ();
$ Chinese mission = new hitting Japan ($ Number of atomic bombs currently );
$ Chinese mission-> attack ();
Running normally under Lamp