title: Objective-c Internals for NSArray and NSMutableArray
body: <p>Very interesting question for all those into Objective-c internals...</p>
  
  <p>So... the <code>NSObject</code> returns the same implementation of <code>copy</code> for both and object and a class (As I expect). However, <code>NSArray</code> and <code>NSMutableArray</code> return not just different implementations of <code>objectAtIndex:</code> for an object and class but each object has a different implementation.</p>
  
  <p>Does anyone know why the follow code produces such behaviour?... (Atleast the class implementations for <code>NSArray</code> and <code>NSMutableArray</code> are the same :) ) </p>
  
  <pre><code>NSObject *obj = [[[NSObject alloc] init] autorelease];
  NSLog(@"NSObject instance %@", [NSValue valueWithPointer:method_getImplementation(class_getInstanceMethod(object_getClass(obj), @selector(copy)))]);
  NSLog(@"NSObject class %@", [NSValue valueWithPointer:method_getImplementation(class_getInstanceMethod([NSObject class], @selector(copy)))]);
  
  NSArray *array = [[[NSArray alloc] init] autorelease];
  NSLog(@"NSArray instance %@", [NSValue valueWithPointer:method_getImplementation(class_getInstanceMethod(object_getClass(array), @selector(objectAtIndex:)))]);
  NSLog(@"NSArray class %@", [NSValue valueWithPointer:method_getImplementation(class_getInstanceMethod([NSArray class], @selector(objectAtIndex:)))]);
  
  NSMutableArray *array1 = [[[NSMutableArray alloc] init] autorelease];
  NSLog(@"NSMutableArray instance %@", [NSValue valueWithPointer:method_getImplementation(class_getInstanceMethod(object_getClass(array1), @selector(objectAtIndex:)))]);
  NSLog(@"NSMutableArray class %@", [NSValue valueWithPointer:method_getImplementation(class_getInstanceMethod([NSMutableArray class], @selector(objectAtIndex:)))]);
  </code></pre>
  
  <p>The Log</p>
  
  <pre><code>2012-11-06 16:35:22.918 otest[71367:303] NSObject instance &lt;c0fa7200&gt;
  2012-11-06 16:35:23.757 otest[71367:303] NSObject class &lt;c0fa7200&gt;
  2012-11-06 16:35:30.348 otest[71367:303] NSArray instance &lt;809a9b00&gt;
  2012-11-06 16:35:31.121 otest[71367:303] NSArray class &lt;70bfa700&gt;
  2012-11-06 16:35:33.854 otest[71367:303] NSMutableArray instance &lt;f05f9a00&gt;
  2012-11-06 16:35:34.824 otest[71367:303] NSMutableArray class &lt;70bfa700&gt;
  </code></pre>