Polymorphic copy: Difference between revisions

(→‎{{header|Tcl}}: Omit PureBasic)
Line 592:
}
- (id)copyWithZone:(NSZone *)zone {
return NSCopyObject(self, 0, zone); // polymorphically copy self
 
// or:
// T *copy = [[T allocWithZone:zone] init]; // call an appropriate constructor here
// // then copy data into it as appropriate here
// // however, this way is not polymorphic
// return copy;
}
Anonymous user