Re: A legitimate argument for calling dealloc directly?
Re: A legitimate argument for calling dealloc directly?
- Subject: Re: A legitimate argument for calling dealloc directly?
- From: Mike Shields <email@hidden>
- Date: Tue, 14 Jan 2003 16:06:11 -0700
Daniel,
I just had a brainstorm here. Right now you're subclassing to get the
behavior you want, right? well why not try composition instead?
@interface MyClass
{
id myivar1;
[other ivars]...
MyUsedToBeSuperClass* forwarder;
}
- (id) init;
- (void) reinit;
etc.
@end
Then in the implementation use forwarding to forward all unknown
messages to the forwarder. This should get you back to where you are
now. (read
file:///Developer/Documentation/Cocoa/ObjectiveC/
4objc_runtime_overview/index.html for information on how to do this)
Now as to the reinit problem - when you need to re-init, you can
re-init the previously super-class object (release, realloc/init) and
then update your own object's internal state to the new values you need.
Does this all make sense?
On Tuesday, January 14, 2003, at 11:30 AM, Daniel Jalkut wrote:
Thanks, you guys. Obviously a mental exercise I should have tried out
at least once before speculating on it in public ;) I will find a
better way to achieve what I need to do ...
Apart from the immediate core-dump? No ;-)
_______________________________________________
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.