«« Next » « Previous
«« Next » « Previous

Link Details

Announcement

iPhone DZone: Fresh Links On Your iPhone by matt at Sat Jul 05 14:09:51 EDT 2008

Reading DZone on your iPhone just got a little bit easier. Visit http://dzone.com/iphone from your iPhone to try out our beta iPhone support. You can view stories, filter by tags, and login. We'd appreciate your feedback at feedback@dzone.com.

You do understand how this works, don't you? Login and vote now.
Link 65202 thumbnail

By ferruccio
via the-lazy-programmer.com
Published: Feb 08 2008 / 11:51

This article describes a technique for binding C++ objects using references rather than pointers.
  • 7
  • 5
  • 1063
  • 256

Comments

Add your comment
User 236137 avatar

dzonelurker replied ago:

0 votes Vote down Vote up Reply

He discovered member initialization lists (a basic C++ feature, covered on page 3 in most C++ books).

User 200723 avatar

ferruccio replied ago:

0 votes Vote down Vote up Reply

Actually, what I discovered was that member initialization could be used with references. This was not obvious to me when I read the first edition of Stroustrup years ago. The current edition does mention it.

User 230072 avatar

bmi32 replied ago:

0 votes Vote down Vote up Reply

And having a reference does not guarantee that the underlying object is still alive.
,

User 200723 avatar

ferruccio replied ago:

0 votes Vote down Vote up Reply

No, it doesn't. Which is why you would only want to do this with objects that have to stick around for the referring object to work at all.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (7)



Voters Against This Link (5)