• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Copy constructing to a subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Encryption
  • Next by Date: displaying NSUpArrowFunctionKey, NSDeleteFunctionKey and friends?
  • Previous by thread: Re: Thinking about shareware prices... (was a question about NSDate inside userDefaults)
  • Next by thread: Re: Copy constructing to a subclass
  • Index(es):
    • Date
    • Thread