User Tools

Site Tools


duck

Duck

Return to Duck typing

duck on Wiktionary

duck typing - determining the properties of a type, often in a template when choosing what algorithms to use with objects of that type, based solely on the syntactic interface it supports. As this approach has no way to check for or enforce semantic requirements, it must rely on the aphorism, “If it looks like a duck and walks like a duck, it must be a duck.” friend ’11 (1052)” (EMCppSfe 2021)

Snippet from Wikipedia: Duck

Duck is the common name for numerous species of waterfowl in the family Anatidae. Ducks are generally smaller and shorter-necked than swans and geese, which are members of the same family. Divided among several subfamilies, they are a form taxon; they do not represent a monophyletic group (the group of all descendants of a single common ancestral species), since swans and geese are not considered ducks. Ducks are mostly aquatic birds, and may be found in both fresh water and sea water.

Ducks are sometimes confused with several types of unrelated water birds with similar forms, such as loons or divers, grebes, gallinules and coots.

Snippet from Wikipedia: Duck typing

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. Duck typing may be viewed as a usage-based structural equivalence between a given object and the requirements of a type.


© 1994 - 2024 Cloud Monk Losang Jinpa or Fair Use. Disclaimers

SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.


duck.txt · Last modified: 2024/04/28 03:33 (external edit)