一位朋友最近问道:“CPython解释器如何实际处理OOP(面向对象编程)?”。CPython解释器如何处理OOP
这个问题最终使我困惑,我的理解C是不是面向对象的语言。
我试过Googling it,搜索StackOverflow甚至读CPython Wiki。但是我找不到任何有用的东西。
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def getInfo(self):
return "Name: " + self.name + "\nAge: " + str(self.age)
# How the heck does CPython handle this?
personOne = Person("Bob", 34)
personTwo = Person("Rob", 26)
print(personOne.getInfo())
print(personTwo.getInfo())
所以现在我真的很想知道!如果CPython解释器本身不是面向对象的,那么CPython解释器如何处理对象?