[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/Lovepython015/Python/master/Article/PythonBasis/python8/8.md [Back]  [Original]

#  #





```
>>> 1 + 2
3
>>> 'a' + 'b'
'ab'
```

 +  + 







```python
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

class User(object):
    def __init__(self, name):
        self.name = name

    def printUser(self):
        print('Hello !' + self.name)


class UserVip(User):
    def printUser(self):
        print('Hello ! Vip' + self.name)


class UserGeneral(User):
    def printUser(self):
        print('Hello ! ' + self.name)


def printUserInfo(user):
    user.printUser()


if __name__ == '__main__':
    userVip = UserVip('')
    printUserInfo(userVip)
    userGeneral = UserGeneral('')
    printUserInfo(userGeneral)

```

:

```txt
Hello ! Vip
Hello ! 
```

userVip  userGeneral  printUserInfo  printUser 




 [https://github.com/TwoWater/Python](https://github.com/TwoWater/Python)  Gitbooks


Web Proxy Viewer  |  New URL  |  Original Page