• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Learning java, coming from C++

 
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:THe destructor of the smart pointer decrements the reference count. When the reference count hits 0, the object that the pointer points to is deallocatted.


The same idea implemented in Objective-C memory management, which uses retain, release, autorelease, alloc, dealloc, copy, and NSAutoreleasePool for references.

Jeff Verdegan wrote:

When you say "the object of the smart pointer is copied", you mean "the 'real' pointer that is wrapped by the the smart pointer is copied,"


Do you mean deep copy of an object?

Jayesh A Lalwani wrote:In C++, the object is the TV, and the pointer is the remote.


Awesome comprison. Where can we find more metaphors like that? It really helps to understand.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't take credit for the cup metaphor. It was created by a mind greater than mine. The complete metaphor is posted Here
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:The complete metaphor is posted Here


Very nice. Thanks!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic