{"id":4414,"date":"2014-03-30T10:45:09","date_gmt":"2014-03-30T10:45:09","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/objc-using-super-in-conjunction-with-overriding-collection-of-common-programming-errors\/"},"modified":"2014-03-30T10:45:09","modified_gmt":"2014-03-30T10:45:09","slug":"objc-using-super-in-conjunction-with-overriding-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/objc-using-super-in-conjunction-with-overriding-collection-of-common-programming-errors\/","title":{"rendered":"ObjC: using &ldquo;super&rdquo; in conjunction with overriding-Collection of common programming errors"},"content":{"rendered":"<p>I have a class A and a class B which is a subclass of A. Both have the following methods:<\/p>\n<pre><code>-(void)anotherMethod{\n    \/\/ implementation of A or B\n}\n\n-(void)aMethod{\n    @try{\n        [super aMethod];\n    }\n    @catch(NSException *e){\n    }\n    [self anotherMethod];\n}\n<\/code><\/pre>\n<p>Now: if I call <code>[instanceOfClassB aMethod]<\/code> the instruction <code>[self anotherMethod]<\/code> contained in A&#8217;s implementation of <code>aMethod<\/code> calls B&#8217;s <code>anotherMethod<\/code> (since it&#8217;s overridden) instead of A&#8217;s one. How can I make A&#8217;s implementation of <code>aMethod<\/code> call A&#8217;s implementation of <code>anotherMethod<\/code>?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a class A and a class B which is a subclass of A. Both have the following methods: -(void)anotherMethod{ \/\/ implementation of A or B } -(void)aMethod{ @try{ [super aMethod]; } @catch(NSException *e){ } [self anotherMethod]; } Now: if I call [instanceOfClassB aMethod] the instruction [self anotherMethod] contained in A&#8217;s implementation of aMethod [&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-4414","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4414","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=4414"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4414\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}