1. 程式人生 > >python內部類

python內部類

#!/usr/bin/python


class outerclass:
    msg = "I am outer class"


    class interclass:
        msg = "I am inter class"


o1 = outerclass()
print o1.msg
i1 = o1.interclass()
print i1.msg


i2 = outerclass.interclass()
print i2.msg