Duck typing
Style of dynamic typing in object-oriented programming / From Wikipedia, the free encyclopedia
Dear Wikiwand AI, let's keep it short by simply answering these key questions:
Can you list the top facts and stats about Duck typing?
Summarize this article for a 10 year old
SHOW ALL QUESTIONS
In computer programming, duck typing is an application of the duck test—"If it walks like a duck and it quacks like a duck, then it must be a duck"—to determine whether an object can be used for a particular purpose. With nominative typing, an object is of a given type if it is declared as such (or if a type's association with the object is inferred through mechanisms such as object inheritance). With duck typing, an object is of a given type if it has all methods and properties required by that type.[1][2] Duck typing may be viewed as a usage-based structural equivalence between a given object and the requirements of a type.