tags:

views:

27

answers:

1
class Dictionary {
    private $translations = array();
    private $dictio;
    private $type;

    function __construct( $type, DictionaryIO $dictio ) {
        $this->type = $type;
        $this->dictio = $dictio;
    }

    // ...
}

$en = new Dictionary( "En", new DictionaryIO() );
$en->dictio = null;

i saw something like above code. Someone can tell me effective of line code

$en = new Dictionary( "En", new DictionaryIO() );
+1  A: 

Someone can tell me effective of line code

A new object of the class Dictionary is created. The two arguments are passed to the constructor function, which stores them internally.

The DictionaryIO prefix in front of DictionaryIO $dictio is a so called type hint that forces the second parameter to be an object of the class DictionaryIO.

The last line

$en->dictio = null;

will not work because $dictio is private.

Pekka
oh , thank you very much , meet u again :D
Chameron