• 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: Overriding retain/release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding retain/release


  • Subject: Re: Overriding retain/release
  • From: Marcel Weiher <email@hidden>
  • Date: Fri, 6 Jun 2003 10:49:16 +0200

On Friday, June 6, 2003, at 10:32 Uhr, Oscar Morales Vivs wrote:

Greetings to all.

I have a big load of C++ classes that already implement reference counting, and was thinking about generically bridging them to Obj-C so I could use them as items in an NSOutlineView (by handling the C++ objects from Obj-C helper objects that implement the appropiate functions to give the NSOutlineView the data it wants).

OK, sounds good.

I though about just overriding retain and release for my bridge object base class, but I don't know if there's any pitfalls I might fall into, any other functions I should override if I want to go that way, or any apocalyptic consequences of such an action.

I don't know the details of this particular implementation, but it overriding retain/release seems unnecessary. Just increase the reference count of your C++ object by one when the wrapper/bridge is created, and decrease it again when it is destroyed, just like any other reference.

Regards,

Marcel

--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
f0249ab8b1af193ef5addcf39fdff5ca
_______________________________________________
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.

References: 
 >Overriding retain/release (From: Oscar Morales Vivó <email@hidden>)

  • Prev by Date: Overriding retain/release
  • Next by Date: MouseDown moves window
  • Previous by thread: Overriding retain/release
  • Next by thread: MouseDown moves window
  • Index(es):
    • Date
    • Thread