我们使用 Student
类创建了一个名为 x
的对象。
What is the correct syntax to execute the printname
method of the object x
?
class Person:
def __init__(self, fname):
self.firstname = fname
def printname(self):
print(self.firstname)
class Student(Person):
pass
x = Student("Mike")
@(13)
class Person:
def __init__(self, fname):
self.firstname = fname
def printname(self):
print(self.firstname)
class Student(Person):
pass
x = Student("Mike")
x.printname()