-
-
Save monsat/4d5ffe76054379f1c176 to your computer and use it in GitHub Desktop.
Classについて、このPHPコードの実行結果が分かる程度の理解が必要です
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User { | |
public $name = 'user'; | |
public $age = 20; | |
} | |
class Admin extends User { | |
public $name = 'admin'; | |
} | |
$user = new User(); | |
$user->age = 30; | |
echo $user->name; | |
echo $user->age; | |
$admin = new Admin(); | |
echo $admin->name; | |
echo $admin->age; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment