• 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
Subclassing an object's creation method (NSBezierPath's +bezierPath)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Subclassing an object's creation method (NSBezierPath's +bezierPath)
      • From: Peter Maurer <email@hidden>
    • Re: Subclassing an object's creation method (NSBezierPath's +bezierPath)
      • From: Prachi Gauriar <email@hidden>
  • Prev by Date: Re: How far with accessors?
  • Next by Date: Re: Notification from ABPeoplePickerView
  • Previous by thread: autorelease and distributed objects
  • Next by thread: Re: Subclassing an object's creation method (NSBezierPath's +bezierPath)
  • Index(es):
    • Date
    • Thread