• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: super constructor encapsulation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >super constructor encapsulation (From: "Ahmet Taha Sakar" <email@hidden>)

  • Prev by Date: super constructor encapsulation
  • Next by Date: Re: super constructor encapsulation
  • Previous by thread: super constructor encapsulation
  • Next by thread: Re: super constructor encapsulation
  • Index(es):
    • Date
    • Thread