예제 #1
0
<?php
header('Content-Type:text/html; charset=utf-8');
class A{
	const c = "ConstA";

	public function m(){
		echo self::c;
	}
}


class B extends A{
	const c="constB";
}

$b = new B();
$b->m();
?>
예제 #2
0
파일: 2079.php 프로젝트: badlamer/hhvm
<?php

trait T
{
    public function m()
    {
        echo "original\n";
    }
}
class A
{
    use T;
}
class B
{
    use T;
}
T::m();
$a1 = new A();
$a1->m();
fb_intercept("T::m", function () {
    echo "new\n";
});
$a2 = new A();
$a2->m();
$b1 = new B();
$b1->m();
T::m();
예제 #3
0
<?php
/*

*/
header('Content-Type:text/html; charset=utf-8');
class A{
	const c = "ConstA";

	public function m(){
		echo self::c;
	}
}


class B extends A{
	const c="constB";
}

$b = new B();
$b->m(); //输出ConstA
?>