{"id":4301,"date":"2014-03-30T09:44:35","date_gmt":"2014-03-30T09:44:35","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-i-call-an-overridden-method-from-the-super-of-the-super-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:44:35","modified_gmt":"2014-03-30T09:44:35","slug":"can-i-call-an-overridden-method-from-the-super-of-the-super-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-i-call-an-overridden-method-from-the-super-of-the-super-collection-of-common-programming-errors\/","title":{"rendered":"Can I call an overridden method from the super of the super?-Collection of common programming errors"},"content":{"rendered":"<p>It&#8217;s not possible in Java. You can use <code>super<\/code> but it always uses the method in immediate superclass in type hierarchy.<\/p>\n<p>Also note that this:<\/p>\n<pre><code>Foo f = (Foo) this;\nf.fn();\n<\/code><\/pre>\n<p>is the very definition of <strike>polymoprhism<\/strike> how virtual call works: even though <code>f<\/code> is of type <code>Foo<\/code>, but at runtime <code>f.fn()<\/code> is dispatched to <code>Bar.fn()<\/code>. Compile-time type doesn&#8217;t matter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s not possible in Java. You can use super but it always uses the method in immediate superclass in type hierarchy. Also note that this: Foo f = (Foo) this; f.fn(); is the very definition of polymoprhism how virtual call works: even though f is of type Foo, but at runtime f.fn() is dispatched to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4301","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4301"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4301\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}