87_结构体变量传递

# 结构体变量传递
class Student:
    x = 0
    c = 1

def f(stu:Student):
    stu.x = 20
    stu.c = 'c'

a = Student()
print(a.x,a.c)
a.x = 1
a.c = 'b'
print(a.x,a.c)
f(a)
print(a.x,a.c)
posted @ 2024-09-27 16:19  人要靠自己you  阅读(9)  评论(0)    收藏  举报