Code:
class Foo { protected double seconds = 0; public double hours { get { return seconds / 3600; } set { seconds = value * 3600; } } } Foo f = new X(); f.hours = 3;
class Foo { protected double seconds = 0; public double hours { get { return seconds / 3600; } set { seconds = value * 3600; } } } Foo f = new X(); f.hours = 3;
Interface Action
{
public function dispatcher($action);
}
Class SampleAction implements Action
{
public function dispatcher($action)
{
if(method_exists($this, $action)) {
call_user_func(array($this, $action));
} else {
throw new Exception('Dispatching failed');
}
}
}
public function __call($fn, $p)
{
if (!method_exists($this, $fn))
{
throw new ....;
}
}
int parse() { Token tok; reading: tok = gettoken(); if (tok == END) return ACCEPT; shifting: if (shift(tok)) goto reading; reducing: if (reduce(tok)) goto shifting; return ERROR; }
Einen Kommentar schreiben: