类:
1、类的概念在许多语言中出现,很容易理解。它将数据和操作进行封装,以便将来的复用。
2、python中的类和java中的类一样,用class来定义
那么首先我们来定义一个class类,名叫ko。
二、首先类的调用分两钟:
第一种:内部调用是在里面调
定义一个k,调用里面的减法法,相对,里面减法也一样
类的内部调用:self.<方法名>(参数列表)。self表达的就是类的本身
运行结果:
18