来,我们先来温习一下类的结构。
看着这个结构,提一个问题,如何修改类属性,也就是类里面的变量?
从类结构来看,我们可以猜测,从类方法来修改,也就是从类内部来修改和增加类属性。
看下具体的实例:
这里还是强调一下,例子还是要自己多写,不要只看,自己运行, 看效果。多想。
我们刚刚看了通过类方法来修改类的属性,这时我们看下从外部如何修改和增加类属性。
例子如下:
GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python-Introduction-Tutorial/Article/PythonBasis/python8/4.md at master · Sogrey/Python-Introduction-Tutorial |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |