How to create a data type only for use inside one class in objective-c?
===

I think I've seen this done, but I can't find documentation on it because I don't think I know the correct terms. I need to know how to write a special class that's only for use inside one other class, and therefore can be entirely written inside the other class's implementation.

Basically I need a specialized NSMutableArray that can do three extra things:

 - remove the most recent item once it's asked for  
 - store that item in a last_most_recent_item variable
 - track whether or not a new item has been added
 - if a new item *hasn't* been added, and the last object in the array is asked for, return the last_most_recent_item instead of the actual last item

But, and here's the thing, I only need this SpecialNSArray inside of one class. So I'd like to put the declaration and implementation inside that class, instead of in separate files. I believe I've seen that done. Does anyone know what that's called, and how I could do it?