{"id":4542,"date":"2014-03-30T13:27:39","date_gmt":"2014-03-30T13:27:39","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-create-a-data-type-only-for-use-inside-one-class-in-objective-c-collection-of-common-programming-errors\/"},"modified":"2014-03-30T13:27:39","modified_gmt":"2014-03-30T13:27:39","slug":"how-to-create-a-data-type-only-for-use-inside-one-class-in-objective-c-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-create-a-data-type-only-for-use-inside-one-class-in-objective-c-collection-of-common-programming-errors\/","title":{"rendered":"How to create a data type only for use inside one class in objective-c?-Collection of common programming errors"},"content":{"rendered":"<p>I think I&#8217;ve seen this done, but I can&#8217;t find documentation on it because I don&#8217;t think I know the correct terms. I need to know how to write a special class that&#8217;s only for use inside one other class, and therefore can be entirely written inside the other class&#8217;s implementation.<\/p>\n<p>Basically I need a specialized NSMutableArray that can do three extra things:<\/p>\n<ul>\n<li>remove the most recent item once it&#8217;s asked for<\/li>\n<li>store that item in a last_most_recent_item variable<\/li>\n<li>track whether or not a new item has been added<\/li>\n<li>if a new item <em>hasn&#8217;t<\/em> been added, and the last object in the array is asked for, return the last_most_recent_item instead of the actual last item<\/li>\n<\/ul>\n<p>But, and here&#8217;s the thing, I only need this SpecialNSArray inside of one class. So I&#8217;d like to put the declaration and implementation inside that class, instead of in separate files. I believe I&#8217;ve seen that done. Does anyone know what that&#8217;s called, and how I could do it?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I think I&#8217;ve seen this done, but I can&#8217;t find documentation on it because I don&#8217;t think I know the correct terms. I need to know how to write a special class that&#8217;s only for use inside one other class, and therefore can be entirely written inside the other class&#8217;s implementation. Basically I need a [&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-4542","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4542","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=4542"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4542\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}