aspose file tools*
The moose likes Beginning Java and the fly likes Learning java, coming from C++ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Learning java, coming from C++" Watch "Learning java, coming from C++" New topic
Author

Learning java, coming from C++

surlac surlacovich
Ranch Hand

Joined: Mar 12, 2013
Posts: 296

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
Bartender

Joined: Jan 17, 2008
Posts: 2319
    
  28

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

Joined: Mar 12, 2013
Posts: 296

Jayesh A Lalwani wrote:The complete metaphor is posted Here

Very nice. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Learning java, coming from C++