I think that I almost understand what will be static or dynamic dispatch.
As far as I know, struct instance with struct type will be always static dispatch.
struct A {
func yo() {
print("A")
}
}
var a: A = A()
a.yo()
But, struct instance with protocol type (using protocol method) will be dynamic dispatch without using protocol & extension.
protocol Foo {
func yo()
}
struct A: Foo {
func yo() {
print("A")
}
}
var a: Foo = A()
a.yo()
So, I just wonder that "Can struct type be dynamic dispatch?" If will, Could you tell me some example? ⬇️ ?? is anything instance
var a: structType = ??
a.yo()