Re: Calling a super call method from and instance
Re: Calling a super call method from and instance
- Subject: Re: Calling a super call method from and instance
- From: Jonathan Hess <email@hidden>
- Date: Thu, 7 May 2009 13:52:49 -0700
Hey Dave -
Usually wanting to do something like this points to some design flaw,
but if you really want to invoke classA's implementation there are a
number of ways to do it.
One way would be to put a category on MyClassB like this:
@implementation MyClassB(PassThrough)
- (void)aboutMySuperClass {
[super about Me];
}
@end
Then from "-(void) someMethod:(MyClassB*) myClass" invoke "[myClass
aboutMySuperClass]".
Good Luck -
Jon Hess
You could put a category on MyClassB
On May 7, 2009, at 1:37 PM, David Alter wrote:
In Objective-C 1.0 (not 2.0 ) is there a way to call a super class
method if
I have a reference to the class
See bellow
@interface MyClassA : NSObject {
}
-(void) aboutMe ;
@end
@implementation MyClassA
-(void) aboutMe ;
{
NSLog(@"I'm Class A");
}
@end
@interface MyClassB :MyClassA {
}
-(void) aboutMe ;
@end
@implementation MyClassB
-(void) aboutMe ;
{
NSLog(@"I'm Class B");
}
@end
-(void) someMethod:(MyClassB*) myClass
{
//I want to call MyClassB's super of aboutMe. This should output
"I'm Class
A"
}
thanks for the help
-dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden