I finished the bit of this that is on dynamic and I now see two uses of it. The first is simple, you may hand a dynamic object to a method which takes a parent and then overload the method with a method which takes a child and if the dynamic object is of the child (has a matching runtime type) it will fall into the child's method when the method signature is called and will otherwise fall into the parent's signature (assuming that the dynamic type is at the very least of the parental type or one of its other child types). Numeric type unification is the other use for dynamic. Hand two dynamic objects into a method and then do mathematics against them. Join them with a + and hand the value back, etc.
No comments:
Post a Comment