1. What is Polymorphism
  2. Categories: Function/Operator overloading, Compile time polymorphism, Function overriding, Runtime Polymorphism
  3. Which function can be overloaded and which functions can’t be overloaded with explanation
  4. Virtual function
  5. Dynamic Binding
  6. Virtual Class
  7. Derived Class
  8. Inline Virtual Function
  9. Abstract Class
  10. Pure virtual function
  11. Pure Virtual Destructor
  12. Instanceof Operator

1. What is Polymorphism

Polymorphism in Swift allows objects of different types to be treated through a common interface, enabling flexible and reusable code. Compile-time polymorphism is achieved through method overloading, where multiple methods with the same name but different parameters can coexist within a class, and operator overloading, which allows custom behavior for operators with user-defined types. Runtime polymorphism is facilitated through method overriding, where a subclass can provide a specific implementation of a method already defined in its superclass, and protocol conformance, where different types can implement the same protocol and be used interchangeably. This flexibility promotes code that can handle various data types and structures in a unified way.

2. Categories: Function/Operator overloading, Compile time polymorphism, Function overriding, Runtime Polymorphism

1. Compile-Time Polymorphism (Static Polymorphism)

Method Overloading: In Swift, you can define multiple methods with the same name but different parameter lists in the same class or struct. This is known as method overloading.