Intermediate Swift
Q54 / 100

What is dynamic dispatch vs static dispatch in Swift?

Correct! Well done.

Incorrect.

The correct answer is B) Static dispatch resolves method calls at compile time (final/struct); dynamic dispatch uses vtable or witness table at runtime (class, protocol)

B

Correct Answer

Static dispatch resolves method calls at compile time (final/struct); dynamic dispatch uses vtable or witness table at runtime (class, protocol)

Explanation

Static dispatch enables inlining and is faster. Mark classes final for static dispatch. Protocol methods use witness tables (dynamic). Classes use vtables.

Progress
54/100