Re: super constructor encapsulation
Re: super constructor encapsulation
- Subject: Re: super constructor encapsulation
- From: Scott Ribe <email@hidden>
- Date: Fri, 13 Apr 2007 10:32:53 -0600
- Thread-topic: super constructor encapsulation
Objective-C doesn't really enforce that kind of constraint. It is accepted
practice to deal with this by documenting it. There is also the notion of
"designated initializer", which if you aren't familiar with you should
probably look up.
That said, I'm pretty sure that (unlike C++) in your example in the body of
initWithHeight:width: the self pointer would already be a ClassB, not a
ClassA, and therefore you could make a check yourself using the -class,
-isKindOfClass, or -isMemberOfClass methods, and throw an exception for an
improper call. That would get you a runtime error. I don't know of a way to
get a compile-time error. (In Objective-C there are @public, @protected and
@private compiler directives, but not only are they not really a common
idiom, they only apply to instance variables, not methods.)
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
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