Polymorphism is a concept in object-oriented programming where objects of different classes can be treated as if they are the same type. In Swift, this means that objects that conform to the same protocol can be used interchangeably, even though they are of different types. For example, let's say we have two classes, Rectangle and Circle, which both conform to a Shape protocol. We can create an array of Shape objects and add instances of Rectangle and Circle to it. Then we can loop through the array and call the same method on each object, even though they are of different types. This is because they all conform to the Shape protocol and implement the required methods. Polymorphism allows for greater flexibility and reuse of code, as we can write methods that work on multiple types of objects without needing to know their specific class. It also makes it easier to write generic code that can work with any type that conforms to a certain protocol, rather than needing to write separate code for each specific type. see this: https://www.cosmiclearn.com/swift/polymorphism.php Definition of Polymorphism: Poly means many and Morphism means form. Polymorphism is when a class or function is used in different places with the same name. Polymorphism can be done in two ways – 1st: When the same function of a class is used repeatedly with the same name in different ways, it is called polymorphism. This process is also called overloading. 2nd: When a class is inherited by another class with the same name and used in different ways, it is called polymorphism. This process is also called overriding. /// Bangla Explain: পলিমরফিজম এর সংজ্ঞা: Poly মানে হলো বিভিন্ন বা অনেক বা বহু, আর Morphism মানে হলো রূপ। কোনো ক্লাসকে বা ফাঙ্কশনকে একই নামে অন্য জায়গায় বিভিন্নরূপে ব্যবহার করা হলে তাকে পলিমরফিজম বলে। পলিমরফিজম দুইভাবে করা যায় - ১ম : কোনো ক্লাসের একই ফাঙ্কশন বার বার একই নামে বিভিন্নরূপে ব্যবহার করা হলে তাকে পলিমরফিজম বলে। এই প্রক্রিয়াটাকে ওভারলোডিংও বলে। ২য় : কোনো ক্লাসকে একই নামে অন্য কোনো ক্লাসে ইনহেরিট করে বিভিন্ন অর্থে ব্যবহার করা হলে তাকে পলিমরফিজম বলে। এই প্রক্রিয়াটাকে ওভাররাইডিংও বলে। এবার চলুন আমরা সুইফ্টে পলিমরফিজমের উদাহরণ হিসাবে দেখে আসি -> Now let's look at as an example of polymorphism in Swift -> // 1st: // MARK: Definition of Polymorphism -> /// Method Overloading Polymorphism -> class OverLoad { public func student_Information(name: String) -> String { return "Name \(name)." } func student_Information(name: String, id: Int) -> String { return "Name: \(name). ID: \(id)." } func student_Information(name: String, id: Int, address: String) -> String { return "Name: \(name), ID: \(id), Address: \(address)." } } let st_I = OverLoad() print(st_I.student_Information(name: "MD Murad Hossain")) print(st_I.student_Information(name: "MD Faysal Ahmed", id: 124554)) print(st_I.student_Information(name: "MD Abul Kasehem", id: 343243, address: "Chadpur, Chittagong")) // 2nd: // MARK: Methode Overriding Polymorphism -> class Person { public func man() { print("Hi!, I'm a person.") } } class Student: Person { public override func man() { print("Hi!, I'm a student.") } } class Teacher: Person { public override func man() { print("Hi!, I'm a teacher.") } } let p = Person() let s = Student() let t = Teacher() p.man() s.man() t.man()