duck-typing
Can I get dynamic to work like this?
I have a Patient class: class Patient { public string First_Name { get; set; } public string Last_Name { get; set; }[详细]
2023-04-11 08:43 分类:问答Actionscript Duck-typing
I\'m overriding a protected function in a subclass. Let\'s say I ha开发者_运维技巧ve two classes, Apple and Fruit.[详细]
2023-04-07 12:45 分类:问答C++ Compile-time Duck Typing with Interfaces
Is there a way to do something like the following in C++ template<typename TAnimal> bool can_eat(TAnimal& animal) where bool TAnimal::IsAlive() exists[详细]
2023-04-01 11:22 分类:问答Python duck-typing for MVC event handling in pygame
A friend and I have been playing around with pygame some and came across this tutorial for building games using pygame. We really liked how it broke out the game into a model-view-controller system wi[详细]
2023-03-31 16:25 分类:问答F# and duck-typing
Let\'s say I defined in F# the following two types: type Dog = { DogName:string; Age:int } type Cat = { CatName:string; Age:int }[详细]
2023-03-27 23:56 分类:问答How to translate this duck-typing (Python) to Java generics?
Consider the following simple Python function by way of example: def qua开发者_开发百科ntize(data, nlevels, quantizer=lambda x, d: int(floor(x/d))):[详细]
2023-03-25 21:04 分类:问答How to detect an array- or set-like value while avoiding type checks
I have a method which accepts an argument which can be an Array/Set-like object, or a Hash. The gist of the method is something like:[详细]
2023-03-22 00:28 分类:问答Java: How to declare that a variable implements an interface?
In Objective-C, I could do: id<HTTPRequestDelegate> delegate; to say that delegate (a variable of type id) conforms to the HTTPRe开发者_C百科questDelegate protocol (or implements the HTTPRequ[详细]
2023-03-17 17:37 分类:问答How to handle "duck typing" in Python?
I usually want to keep my code as generic as possible. I\'m currently writing a simple library and being able to use different types with my library feels extra important this time.[详细]
2023-03-17 07:00 分类:问答Duck typing in the C# compiler
Note This is not a question about how to implement or emulate duck typing in C#... For several years I was under the impression that 开发者_开发百科certain C# language features were depdendent on data[详细]
2023-03-13 19:53 分类:问答