Re: Inheriting a problem
Re: Inheriting a problem
- Subject: Re: Inheriting a problem
- From: Greg Titus <email@hidden>
- Date: Mon, 6 Jan 2003 17:11:00 -0800
Basically, yes, you must be wrong. You actually really do have an
UpperClass. The Objective-C runtime doesn't care at all about casting -
it gets compiled into nothing. If you are getting a
does-not-recognize-selector error then it is really and truly because
that object doesn't recognize that selector.
Hope this helps,
-Greg
On Monday, January 6, 2003, at 05:04 PM, Mike O'Connor wrote:
This is probably a newbie question as I am relatively new to Cocoa but
an example of the problem I'm getting is: Say I have a class
UpperClass and a class that inherits from it, LowerClass. LowerClass
has a method LowerMethod I want to call, but the object I have says it
is an UpperClass. So if I try to call LowerMethod on it, I get an
error that it does not recognize the selector.
I tried casting it [(LowerClass*)theObject LowerMethod] but this
doesn't work. I also tried assigning the pointer to it to a pointer
defined as LowerClass but the dubugger shows it "isa" UpperClass and I
get the same error. Is there something else I should try? I believe my
object really is a LowerClass, but the system is passing it as an
UpperClass - unless I must be wrong about that? TIA
_______________________________________________
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.
_______________________________________________
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.