Pass by value
• Creates a copy of the value when passed to a function
• Better in multi-threaded environment
• Required in distributed and remote systems.
• Simple memory management
• In some implementations, takes less memory than reference
types because there is no pointer, inherited properties.
• Some languages reduce memory overhead of copies by using
Pass by reference
• No copying of data (only creation of a pointer) which
can means less memory
• Many functions/classes can share a single object
• Memory must be managed (reference counting or
• Can cause problems with multithreading
• Can return ‘multiple values’ from a function
Java PrimitiveType (NumericType and boolean)
Booleans, integers and floats (of their various widths)
Objective-C C scalars (int, float, char)
Objective-C scalars (NSInteger, CGFloat, BOOL)
C structures (NSRange, CLLocationCoordinate2D)
Swift Almost all built-in types including Dictionary, Array and String.
In Swift 2, 87 of 99 types are value types.
Java Anything that inherits from Object
Objective-C Anything that inherits from NSObject
• In Java, references to object are passed by value (e.g.
a new reference is created when passed)