Copy of an NSObject subclass

NSObject class does not support copying so it has to be implemented in its subclass. If a class MyClass is an NSObject subclass, it needs to implement NSCopying protocol and its copyWithZone method in order for its instance to be copied. The MyClass variables are defined below…