類別 Class
Python 基礎: 類別 Class
class Car:
def Drive(self):
print('Drive Car')
Car1 = Car()
print('Car1', Car1)
print('type Car1', type(Car1))
print('Car1 is instance Car:', isinstance(Car1, Car))
Car1.Drive()
# Car1 <__main__.Car object at 0x1064b0940>
# type Car1 <class '__main__.Car'>
# Car1 is instance Car: True
# Drive Car