Creating an instance of a subclass from a superclass initilization
Creating an instance of a subclass from a superclass initilization
- Subject: Creating an instance of a subclass from a superclass initilization
- From: Philip Dow <email@hidden>
- Date: Mon, 24 Apr 2006 21:45:41 +0200
Hiya,
I have an object called EntryObject. There are two subclasses
EntryObjectFoo and EntryObjectBar. There are times when I am
allocating and initializing an EntryObject and it determines from the
objects I pass into this particular initializer that it should be a
subclass of itself. Instead of calling self = [super init], could I
call self = [EntryObjectFoo designatedInitializer] so that the
subclass receives a redirected init and returns the appropriate class?
If that's okay to do (I'm about to try it to find out), will I have
any memory problems? Are there any other pitfalls in a situation like
this?
-Phil
_______________________________________________
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