{"id":774,"date":"2025-08-04T16:12:37","date_gmt":"2025-08-04T07:12:37","guid":{"rendered":"https:\/\/nexive.tech\/?p=774"},"modified":"2025-08-04T16:12:38","modified_gmt":"2025-08-04T07:12:38","slug":"%e3%80%90%e3%82%b5%e3%82%af%e3%83%83%e3%81%a8%e8%a7%a3%e8%aa%ac%e3%80%91php-%e7%b6%99%e6%89%bf%e3%83%bb%e3%82%aa%e3%83%bc%e3%83%90%e3%83%bc%e3%83%a9%e3%82%a4%e3%83%89%e3%81%ae%e5%9f%ba%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/nexive.tech\/?p=774","title":{"rendered":"\u3010\u30b5\u30af\u30c3\u3068\u89e3\u8aac\u3011PHP \u7d99\u627f\u30fb\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306e\u57fa\u672c\u3068\u5b9f\u88c5\u4f8b"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP\u306b\u304a\u3051\u308b\u30af\u30e9\u30b9\u306e\u7d99\u627f\u3068\u30e1\u30bd\u30c3\u30c9\u306e\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306e\u4ed5\u7d44\u307f\u3092\u89e3\u8aac<\/li>\n\n\n\n<li>\u5b9f\u884c\u53ef\u80fd\u306a\u30b3\u30fc\u30c9\u3067\u57fa\u672c\u69cb\u6587\u3068\u5b9f\u52d9\u7684\u306a\u4f7f\u3044\u65b9\u3092\u78ba\u8a8d<\/li>\n\n\n\n<li>\u5b9f\u88c5\u6642\u306b\u6ce8\u610f\u3059\u3079\u304d\u30dd\u30a4\u30f3\u30c8\u3084\u8aa4\u7528\u4f8b\u3082\u3042\u308f\u305b\u3066\u7d39\u4ecb<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">2. PHP\u306e\u7d99\u627f\u30fb\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>PHP\u306b\u304a\u3044\u3066\u3001\u7d99\u627f\uff08Inheritance\uff09\u3068\u306f\u3001\u3042\u308b\u30af\u30e9\u30b9\uff08\u89aa\u30af\u30e9\u30b9\uff09\u306e\u6a5f\u80fd\u3092\u5225\u306e\u30af\u30e9\u30b9\uff08\u5b50\u30af\u30e9\u30b9\uff09\u304c\u5f15\u304d\u7d99\u3050\u4ed5\u7d44\u307f\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u306e\u518d\u5229\u7528\u6027\u304c\u9ad8\u307e\u308a\u3001\u4fdd\u5b88\u6027\u306e\u5411\u4e0a\u304c\u56f3\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e00\u65b9\u3001\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\uff08Override\uff09\u306f\u3001\u89aa\u30af\u30e9\u30b9\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u5b50\u30af\u30e9\u30b9\u3067\u4e0a\u66f8\u304d\u3057\u3066\u72ec\u81ea\u306e\u5b9f\u88c5\u306b\u5909\u66f4\u3059\u308b\u3053\u3068\u3092\u6307\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u57fa\u672c\u7684\u306a\u632f\u308b\u821e\u3044\u3092\u4fdd\u3061\u3064\u3064\u3001\u500b\u5225\u306e\u6319\u52d5\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u3089\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u306b\u304a\u3051\u308b\u300c\u591a\u614b\u6027\uff08\u30dd\u30ea\u30e2\u30fc\u30d5\u30a3\u30ba\u30e0\uff09\u300d\u3092\u5b9f\u73fe\u3059\u308b\u3046\u3048\u3067\u91cd\u8981\u306a\u8981\u7d20\u3067\u3059\u3002\u5b9f\u52d9\u3067\u306f\u3001\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u62e1\u5f35\u3084\u696d\u52d9\u30ed\u30b8\u30c3\u30af\u306e\u500b\u5225\u5bfe\u5fdc\u306a\u3069\u306b\u983b\u7e41\u306b\u7528\u3044\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p>PHP\u306f\u5358\u4e00\u7d99\u627f\u306e\u307f\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u304a\u308a\u3001<code>extends<\/code>\u30ad\u30fc\u30ef\u30fc\u30c9\u3067\u30af\u30e9\u30b9\u7d99\u627f\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3084\u30c8\u30ec\u30a4\u30c8\u3092\u4f75\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u67d4\u8edf\u306a\u8a2d\u8a08\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u8a73\u7d30\u89e3\u8aac<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u57fa\u672c\u7684\u306a\u7d99\u627f\u3068\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306e\u69cb\u6587<\/h3>\n\n\n\n<p>\u307e\u305a\u306f\u3001\u89aa\u30af\u30e9\u30b9\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u5b50\u30af\u30e9\u30b9\u3067\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3059\u308b\u57fa\u672c\u69cb\u6587\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nclass Animal {\n    public function speak() {\n        echo \"\u9cf4\u304d\u58f0\\n\";\n    }\n}\n\nclass Dog extends Animal {\n    public function speak() {\n        echo \"\u30ef\u30f3\u30ef\u30f3\\n\";\n    }\n}\n\n$dog = new Dog();\n$dog->speak(); \/\/ \u51fa\u529b: \u30ef\u30f3\u30ef\u30f3\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Animal<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">speak<\/span><span style=\"color: #D4D4D4\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u9cf4\u304d\u58f0<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Dog<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">extends<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Animal<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">speak<\/span><span style=\"color: #D4D4D4\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u30ef\u30f3\u30ef\u30f3<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$dog<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Dog<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$dog<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #DCDCAA\">speak<\/span><span style=\"color: #D4D4D4\">(); <\/span><span style=\"color: #6A9955\">\/\/ \u51fa\u529b: \u30ef\u30f3\u30ef\u30f3<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>Dog<\/code>\u30af\u30e9\u30b9\u306f<code>Animal<\/code>\u30af\u30e9\u30b9\u3092\u7d99\u627f\u3057\u3001<code>speak()<\/code>\u30e1\u30bd\u30c3\u30c9\u3092\u72ec\u81ea\u5b9f\u88c5\u3067\u4e0a\u66f8\u304d\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u304c\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u89aa\u30e1\u30bd\u30c3\u30c9\u306e\u547c\u3073\u51fa\u3057\u3068<code>parent::<\/code>\u306e\u4f7f\u3044\u65b9<\/h3>\n\n\n\n<p>\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u6642\u306b\u89aa\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u660e\u793a\u7684\u306b\u547c\u3073\u51fa\u3057\u305f\u3044\u5834\u5408\u306f\u3001<code>parent::<\/code>\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nclass Cat extends Animal {\n    public function speak() {\n        parent::speak(); \/\/ \u89aa\u306e\u9cf4\u304d\u58f0\u3082\u547c\u3076\n        echo \"\u30cb\u30e3\u30fc\\n\";\n    }\n}\n\n$cat = new Cat();\n$cat->speak();\n\/\/ \u51fa\u529b:\n\/\/ \u9cf4\u304d\u58f0\n\/\/ \u30cb\u30e3\u30fc\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Cat<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">extends<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Animal<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">speak<\/span><span style=\"color: #D4D4D4\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #569CD6\">parent<\/span><span style=\"color: #D4D4D4\">::<\/span><span style=\"color: #DCDCAA\">speak<\/span><span style=\"color: #D4D4D4\">(); <\/span><span style=\"color: #6A9955\">\/\/ \u89aa\u306e\u9cf4\u304d\u58f0\u3082\u547c\u3076<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u30cb\u30e3\u30fc<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$cat<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #569CD6\">new<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Cat<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$cat<\/span><span style=\"color: #D4D4D4\">-&gt;<\/span><span style=\"color: #DCDCAA\">speak<\/span><span style=\"color: #D4D4D4\">();<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u51fa\u529b:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u9cf4\u304d\u58f0<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/ \u30cb\u30e3\u30fc<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><code>parent::speak()<\/code>\u306b\u3088\u308a\u3001\u89aa\u306e\u52d5\u4f5c\u3082\u5f15\u304d\u7d99\u3044\u3060\u3046\u3048\u3067\u3001\u5b50\u306e\u52d5\u4f5c\u3092\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">final\u6307\u5b9a\u306b\u3088\u308b\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306e\u7981\u6b62<\/h3>\n\n\n\n<p><code>final<\/code>\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u5b50\u30af\u30e9\u30b9\u306b\u3088\u308b\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3092\u7981\u6b62\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&lt;?php\nclass Base {\n    final public function greet() {\n        echo \"\u3053\u3093\u306b\u3061\u306f\\n\";\n    }\n}\n\nclass Sub extends Base {\n    \/\/ public function greet() {} \/\/ \u30a8\u30e9\u30fc: final\u30e1\u30bd\u30c3\u30c9\u306f\u4e0a\u66f8\u304d\u3067\u304d\u306a\u3044\n}\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Base<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">final<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">function<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">greet<\/span><span style=\"color: #D4D4D4\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #DCDCAA\">echo<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u3053\u3093\u306b\u3061\u306f<\/span><span style=\"color: #D7BA7D\">\\n<\/span><span style=\"color: #CE9178\">&quot;<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Sub<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">extends<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">Base<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\">\/\/ public function greet() {} \/\/ \u30a8\u30e9\u30fc: final\u30e1\u30bd\u30c3\u30c9\u306f\u4e0a\u66f8\u304d\u3067\u304d\u306a\u3044<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u5236\u7d04\u306f\u3001\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u8a2d\u8a08\u306a\u3069\u3067\u300c\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u632f\u308b\u821e\u3044\u306f\u56fa\u5b9a\u300d\u3068\u660e\u793a\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u3088\u304f\u3042\u308b\u30df\u30b9\u30fb\u8aa4\u89e3\u30fb\u843d\u3068\u3057\u7a74<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306e\u7d99\u627f\u5fd8\u308c<\/strong>\uff1aPHP8\u4ee5\u964d\u3067\u3082\u3001\u89aa\u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306f\u81ea\u52d5\u3067\u547c\u3073\u51fa\u3055\u308c\u307e\u305b\u3093\u3002\u5fc5\u8981\u306b\u5fdc\u3058\u3066<code>parent::__construct()<\/code>\u3092\u660e\u793a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u306e\u975e\u4e92\u63db<\/strong>\uff1a\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u6642\u306b\u306f\u3001\u89aa\u3088\u308a\u3082\u5236\u9650\u306e\u5f37\u3044\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\uff08\u4f8b: public \u2192 private\uff09\u306b\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u4e92\u63db\u6027\u9055\u53cd\u3067\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u4e0a\u66f8\u304d\u306f\u5225\u52d5\u4f5c<\/strong>\uff1a\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u540c\u540d\u3067\u518d\u5b9a\u7fa9\u3057\u3066\u3082\u300c\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u300d\u306b\u306f\u306a\u308a\u307e\u305b\u3093\u3002\u521d\u671f\u5024\u306e\u518d\u5b9a\u7fa9\u3084\u53ef\u8996\u6027\u306e\u5909\u66f4\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/li>\n\n\n\n<li><strong>final\u6307\u5b9a\u306e\u898b\u843d\u3068\u3057<\/strong>\uff1a\u30b5\u30fc\u30c9\u30d1\u30fc\u30c6\u30a3\u306e\u30af\u30e9\u30b9\u3084\u30e9\u30a4\u30d6\u30e9\u30ea\u3067final\u6307\u5b9a\u3055\u308c\u305f\u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3088\u3046\u3068\u3057\u3066\u30a8\u30e9\u30fc\u306b\u306a\u308b\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002\u5b9a\u7fa9\u5143\u306e\u4ed5\u69d8\u78ba\u8a8d\u304c\u91cd\u8981\u3067\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5. \u307e\u3068\u3081<\/h2>\n\n\n\n<p>PHP\u306e\u7d99\u627f\u3068\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306f\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u8a2d\u8a08\u306b\u304a\u3051\u308b\u57fa\u672c\u7684\u306a\u4ed5\u7d44\u307f\u3067\u3042\u308a\u3001\u30b3\u30fc\u30c9\u518d\u5229\u7528\u3084\u51e6\u7406\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306b\u6709\u52b9\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u57fa\u672c\u69cb\u6587\u306b\u52a0\u3048\u3066\u3001<code>parent::<\/code>\u3084<code>final<\/code>\u306e\u4f7f\u7528\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3084\u30a2\u30af\u30bb\u30b9\u4fee\u98fe\u5b50\u3068\u306e\u95a2\u4fc2\u306b\u3082\u6ce8\u610f\u3059\u308b\u3053\u3068\u3067\u3001\u5b89\u5168\u304b\u3064\u67d4\u8edf\u306a\u5b9f\u88c5\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \u672c\u8a18\u4e8b\u306e\u30dd\u30a4\u30f3\u30c8 2. PHP\u306e\u7d99\u627f\u30fb\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3068\u306f\uff1f PHP\u306b\u304a\u3044\u3066\u3001\u7d99\u627f\uff08Inheritance\uff09\u3068\u306f\u3001\u3042\u308b\u30af\u30e9\u30b9\uff08\u89aa\u30af\u30e9\u30b9\uff09\u306e\u6a5f\u80fd\u3092\u5225\u306e\u30af\u30e9\u30b9\uff08\u5b50\u30af\u30e9\u30b9\uff09\u304c\u5f15\u304d\u7d99\u3050\u4ed5\u7d44\u307f\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u306e\u518d\u5229\u7528\u6027 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":694,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[85],"tags":[],"class_list":["post-774","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=774"}],"version-history":[{"count":2,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/774\/revisions"}],"predecessor-version":[{"id":871,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/posts\/774\/revisions\/871"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=\/wp\/v2\/media\/694"}],"wp:attachment":[{"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nexive.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}