c++ - member variable as a reference -


what advantage of declaring member variable reference? saw people doing that, , can't understand why.

one useful case when don't have access constructor of object, yet don't want work indirection through pointer. example, if class a not have public constructor , class wants accept a instance in constructor, want store a&. guarantees reference initialized.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -