{"id":2893,"date":"2014-03-10T02:39:08","date_gmt":"2014-03-10T02:39:08","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/10\/can-not-inherit-nsnumber-nsnull-why-collection-of-common-programming-errors\/"},"modified":"2014-03-10T02:39:08","modified_gmt":"2014-03-10T02:39:08","slug":"can-not-inherit-nsnumber-nsnull-why-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/10\/can-not-inherit-nsnumber-nsnull-why-collection-of-common-programming-errors\/","title":{"rendered":"Can not inherit NSNumber, NSNull, &hellip;, why?-Collection of common programming errors"},"content":{"rendered":"<blockquote>\n<p>As with any class cluster, if you create a subclass of NSNumber, you have to override the primitive methods of its superclass, NSValue. Furthermore, there is a restricted set of return values that your implementation of the NSValue method objCType can return, in order to take advantage of the abstract implementations of the non-primitive methods. The valid return values are &#8220;c&#8221;, &#8220;C&#8221;, &#8220;s&#8221;, &#8220;S&#8221;, &#8220;i&#8221;, &#8220;I&#8221;, &#8220;l&#8221;, &#8220;L&#8221;, &#8220;q&#8221;, &#8220;Q&#8221;, &#8220;f&#8221;, and &#8220;d&#8221;.<\/p>\n<\/blockquote>\n<p>More precisely, I believe it&#8217;s because you never actually have an instance of NSNumber. Objective-C has the interesting property that the initializer of a class can actually change the object to which self points (this might actually be true of any method, but I&#8217;ve only ever heard of it being used in the init methods). I believe that NSNumber does this very thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As with any class cluster, if you create a subclass of NSNumber, you have to override the primitive methods of its superclass, NSValue. Furthermore, there is a restricted set of return values that your implementation of the NSValue method objCType can return, in order to take advantage of the abstract implementations of the non-primitive methods. [&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-2893","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2893","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=2893"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2893\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}