[ create a new paste ] login | about

Link: http://codepad.org/kDvuEWR3    [ raw code | output | fork ]

PHP, pasted on Jul 9:
<?php


class firstClass {

    public $thedate;

    function __construct()
    {
        $this->thedate = date('d');
    }

}


class secondClass {

    public $datefrom1stclass;

    function __construct()
    {
        $this->datefrom1stclass = new firstClass;

        echo $this->datefrom1stclass->thedate;

    }

}

new secondClass;


Output:
1
09


Create a new paste based on this one


Comments: