Subclassing an object's creation method (NSBezierPath's +bezierPath)
Subclassing an object's creation method (NSBezierPath's +bezierPath)
- Subject: Subclassing an object's creation method (NSBezierPath's +bezierPath)
- From: Steve Sims <email@hidden>
- Date: Thu, 27 May 2004 19:21:37 -0400
Hey gang,
This is probably a bit of an obj-c newbie question, but I'm curious...
In my app I have a class that's based on NSBezierPath which has two
extra parameters, xLoc and yLoc. I therefore have my own +bezierPath
method which sets these two values to zero as a default setting, as
follows:
+ (MyBez *)bezierPath
{
if (self = [super bezierPath])
{
[self setXLoc: 0];
[self setYLoc: 0];
}
return self;
}
Now my app works fine, but I get two compiler warning for the above
saying the following:
'MyBez' may not respond to '+setXLoc:'
'MyBez' may not respond to '+setYLoc:'
Now this is true, since there are no '+' versions of these setters.
However when I run my app and trace things through the instance
versions of these methods do get called. Obviously this isn't a show
stopper, but I'm wondering why I'm seeing this warning. I've tried
replacing using the setter methods with self->xLoc = 0 and self->yLoc =
0, which also works but has a different compiler warning.
So the question is what's the right, compiler-approved, way of doing
this kind of thing?
Steve
_______________________________________________
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.