• 코드:
​x
 
1
<!DOCTYPE html>
2
<html lang="ko">
3
​
4
<head>
5
    <meta charset="UTF-8">
6
    <title>PHP OOP</title>
7
</head>
8
​
9
<body>
10
​
11
<?php
12
    class A
13
    {
14
        public static function className() {
15
            echo __CLASS__;
16
        }
17
        public static function printClass() {
18
            self::className();
19
        }
20
    }
21
​
22
    class B extends A
23
    {
24
        public static function className() {
25
            echo __CLASS__;
26
        }
27
    }
28
​
29
    B::printClass();    // A
30
?>
31
​
32
</body>
33
​
34
</html>