Re: semantics of init -> Question
Re: semantics of init -> Question
- Subject: Re: semantics of init -> Question
- From: Oscar Morales Vivó <email@hidden>
- Date: Thu, 5 Jun 2003 15:27:36 +0200
Another situation would be when the setting of a variable is connected
with
some other action, as for example a notification being sent. Of
course, one
can in that case write a public and a private setter with the private
setter
setting the variable and the public setter calling the private setter
and
posting the notification (This is more a design problem)
This is what I was thinking. However I'm in doubt about something.
Let's see...:
Suppose I have class A, and class B derived from it. If I create a new
object of class B, and during the execution of class A 'init' I call a
method that is overriden in class B, will it call class A version or
class B version?
It that's the case, then I wouldn't suggest using accessors in init as
you can't know what derived classes could do with them. Could cause
problems if the derived class accessor needs some data that hasn't been
initialized. It's a bigger problem in C++, but it can also be a problem
in Objective-C.
/*
Oscar Morales Vivs
Eternal Computer Science Student. Master of C++ Templates. Cocoa Nut.
Computer Graphics Illuminati. UI Guru in Training. Dabbler in all
things CS and most which are not.
Web stuff:
http://homepage.mac.com/oscarmv/index.html
*/
_______________________________________________
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.