Swift is

protocol Runnable { }
class Person { }
class Student: Person, Runnable { }

var stu: Any = 10

print(stu is Int)// true
stu = "Jack"
print(stu is String)// true
stu = Student()
print(stu is Student)// true
print(stu is Person)// true
print(stu is Runnable)// true

打印结果:

true
true
true
true
true

你可能感兴趣的:(Swift is)