<?php
include_once '../d3.classes.inc.php';
include_once '../prototype.class.inc.php';
$person = cls()->create()->createVar("Person");
$person->toStack("Person");
obj(array(
"initialize" => function($name){$this->name = $name;},
"say" => function($name){return $this->name.": "+$message;}
))
->createVar( $person->get()->prototype(cls::property), false, false )
->toStack();
stack()->colon()->line()->line();
$guy = cls("Miro", $person->getVar())->createVar("guy");
$guy->toStack("guy");
$guy->get()
->say("hi")
->toStack();
stack()->line()->line();
$pirate = cls()->create()->createVar("Pirate");
$pirate->toStack("Pirate");
Object()->extend(
$person->getVar()->newInstance(),
obj(array(
"say" => function($name){return $this->name.": "+$message+", yarr!";}
) )
)
->createVar( $pirate->get()->prototype(Object::property), false, false )
->toStack();
stack()->colon()->line()->line();
$john = cls("Long John", $pirate->getVar())
->createVar("john", true)
->toStack("john");
stack()->get("john")->get()
->say("ahoy matey")
->toStack();
stack()->colon()->line()->line();
echo stack()->getInstance();
|