Re: Cocoa-dev Digest, Vol 4, Issue 496
Re: Cocoa-dev Digest, Vol 4, Issue 496
- Subject: Re: Cocoa-dev Digest, Vol 4, Issue 496
- From: Daniel Child <email@hidden>
- Date: Fri, 25 May 2007 01:24:38 -0400
Actually, I'm interested in how the corresponding "+" version would
go as well. The more I think about this the more confusing it seems.
The user is going to call:
AbstractClass *o ;
[o initWithArg: @"A"]; // or @"B"
o should then be a pointer to an AbstractClass instance, but in the
init method below (assuming - not +), o (which is the same as self)
will be deallocated and now point to an object of type ConcreteA.
So THIS is how the equivalent of Java's typecasting is performed!!??
Thanks.
On May 25, 2007, at 12:15 AM, Jeff Laing wrote:
In Objective C, however, you can have your abstract class do
something like:
+ init {
[self dealloc];
self = [[concreteclass alloc] more SpecialisedInit];
return self;
}
Oops, thats supposed to be -init, not +init because its an instance
method.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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