Dylan (<a href="http:&#x2F;&#x2F;opendylan.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;opendylan.org&#x2F;</a>) does that via generic functions &#x2F; multiple dispatch. The object system in Dylan is derived from CLOS from Common Lisp.<p>Dylan allows sealing of generic functions to limit extensibility where needed and can use that information (along with other information) to optimize, generate warnings, etc.<p><pre><code>    define class &lt;weapon&gt; (&lt;object&gt;) end;
    define class &lt;sword&gt; (&lt;weapon&gt;) end;
    define class &lt;wand&gt; (&lt;weapon&gt;) end;

    define class &lt;person&gt; (&lt;object&gt;) end;
    define class &lt;wizard&gt; (&lt;person&gt;) end;
    define class &lt;warrior&gt; (&lt;person&gt;) end;

    define method wield (who :: &lt;wizard&gt;, what :: &lt;wand&gt;) =&gt; ()
      ...
    end;

    define method wield (who :: &lt;warrior&gt;, what :: &lt;sword&gt;) =&gt; ()
      ...
    end;</code></pre>