Copy constructing to a subclass
Copy constructing to a subclass
- Subject: Copy constructing to a subclass
- From: Nicholas Francis <email@hidden>
- Date: Wed, 7 Jan 2004 21:27:29 +0100
Hi guys...
I want to copy-construct an object to a subclass and am trying to find
a smarter way of doing it... Here's how I do at the moment:
@interface OTEButtonCell : NSButtonCell {
// no private variables
}
-(id)initWithNSButtonCell:(NSButtonCell *)src;
@end
@implementation OTEButtonCell
-(id)initWithNSButtonCell:(NSButtonCell *)src {
self = [super init]; // etc...
[self setControlSize: [src controlSize]];
[self setImagePosition: [src ImagePosition]];
// etc...
return self;
}
@end
My question is: is there a way to avoid having to type out all the
[self setProperty: [src proprty]]... It gets rather tedius and
error-prone...
TIA,
Nicholas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.