プロトタイプベース・オブジェクト指向
at TECH
433:デフォルトの名無しさん
04/02/08 22:56
>>426
421-422 じゃないけど、Python 学習をかねて調べてみました。
class Foo:
def f(self): return "I'm of class"
foo = Foo()
foo.f() => "I'm of class"
bar = Foo()
bar.f() => "I'm of class"
def newF(): return "I'm *not" of class"
foo.f = newF
foo.f() => "I'm *not* of class"
bar.f() => "I'm of class"
def anotherF(self): return "I'm *also* of class"
Foo.f = antoherF
foo.f() => "I'm *not* of class"
bar.f() => "I'm *also* of class"
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5404日前に更新/368 KB
担当:undef