Created
December 15, 2012 14:04
-
-
Save tomoh1r/4295338 to your computer and use it in GitHub Desktop.
インスタンスについて、親クラスの変数の値を変えたらどうなるか、インスタンス自身の値を変えたらどうなるかテスト
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
# coding: utf-8 | |
class Hoge(object): | |
x = 100 | |
hoge = Hoge() | |
print(hoge.x) | |
# => 100 | |
Hoge.x = 200 | |
print(hoge.x) | |
# => 200 | |
hoge.x = 300 | |
print(hoge.x) | |
# => 300 | |
Hoge.x = 400 | |
print(hoge.x) | |
# => 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment