From Polymorphism on WIkipediaIn computer science, polymorphism is a programming language feature that allows values of different data types to be handled using a uniform interface.From duck typing on WikipediaIn computer programming with object-oriented programming languages, duck typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface. My interpretation is that based on duck typing, the objects methods/properties determine the valid semantics. Meaning that the objects current shape determines the interface it upholds.From polymorphism you can say a function is polymorphic if it accepts multiple different data types as long as they uphold an interface. So if a function can duck type, it can accept multiple different data types and operate on them as long as those data types have the correct methods/properties and thus uphold the interface.(Usage of the term interface is meant not as a code construct but more as a descriptive, documenting construct)What is the correct relationship between ducktyping and polymorphism ?If a language can duck type, does it mean it can do polymorphism ?
Is duck typing a subset of polymorphism
object oriented;duck typing;polymorphism