---
title: NSCopyObject
framework: foundation
role: symbol
role_heading: Function
path: foundation/nscopyobject
---

# NSCopyObject

Creates an exact copy of an object.

## Declaration

```occ
extern idNSCopyObject(id object, NSUInteger extraBytes, NSZone *zone);
```

## Parameters

- `object`: The object to copy.
- `extraBytes`: The number of extra bytes required for indexed instance variables (this value is typically 0).
- `zone`: The zone in which to create the new instance (pass NULL to specify the default zone).

## Return Value

Return Value A new object that’s an exact copy of anObject, or nil if object is nil or if object could not be copied.

## Discussion

Discussion This function is deprecated and unavailable for use with ARC. To create a copy of an object, use the copyWithZone: method instead.

## See Also

### Object Allocation and Deallocation

- [NSAllocateObject](foundation/nsallocateobject.md)
- [NSDeallocateObject](foundation/nsdeallocateobject.md)
- [NSDecrementExtraRefCountWasZero](foundation/nsdecrementextrarefcountwaszero.md)
- [NSExtraRefCount](foundation/nsextrarefcount.md)
- [NSIncrementExtraRefCount](foundation/nsincrementextrarefcount.md)
- [NSShouldRetainWithZone](foundation/nsshouldretainwithzone.md)
