• 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
Re: Selector Not Recognized
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selector Not Recognized


  • Subject: Re: Selector Not Recognized
  • From: Nir Soffer <email@hidden>
  • Date: Thu, 13 Jul 2006 02:25:00 +0300


On 12/07/2006, at 01:30, David Alter wrote:

	//Make an instance on MyParent
	MyParent * parent =  [[MyParent alloc] init];

	//Cast MyParent into a pointer of MySub.
	MySub * sub = (MySub *) parent;

//Access a method of MySub.
int val = [sub getSomeDataPlusOne]; // It chokes here with "selector not recognized"

Objective C is simple:

The sub class method is just:

- (int) someDataPlusOne
{
	return somedata + 1 // or did you mean ++somedata ?

}

Sub class may access its super class instance variables (unless you declare them private).

Note that I renamed getSomeDataPlusOne - get is used only for methods that return a value by reference:

- (void)getSomeDataPlusOne:(int *)value
{
	if (value != NULL) *value = somedata + 1;
}

int value;
[sub getSomeDataPlusOne:&value];


Best Regards,

Nir Soffer

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Selector Not Recognized (From: David Alter <email@hidden>)
 >Re: Selector Not Recognized (From: "Shawn Erickson" <email@hidden>)
 >Re: Selector Not Recognized (From: David Alter <email@hidden>)

  • Prev by Date: Re: drawing arrows
  • Next by Date: Re: Getting added object with KVO
  • Previous by thread: Re: Re: Selector Not Recognized
  • Next by thread: Will a breakpoint on objc_exception_throw stop on @throw?
  • Index(es):
    • Date
    • Thread