Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Learning java, coming from C++

 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
  • 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.
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Jayesh A Lalwani wrote:The complete metaphor is posted Here

Very nice. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic