C++ reference type

David Medlock noone at nowhere.com
Sat Jun 24 07:32:16 PDT 2006


Hasan Aljudy wrote:
> Yossarian wrote:
> 
>> Tesuji napsal(a):
>>
>>> Will C++ reference type ever be included in D? In one form or the other?
>>>
>>>
>> what do you mean? every complex object is internally passed by 
>> reference, and if you want the same behaviour as in c++ references, 
>> try inout keyword in declaration:
>> D:   void func(inout int a);
>> is equal to
>> C++: void func(int &a);
> 
> 
> The only thing missing is a reference return type.

The attribute functions in classes serve this purpose do they not?

C++:
int& my_attr();

D:
void my_attr( int );

-DavidM

use, in both cases:
foo.my_attr = 100;

-DavidM



More information about the Digitalmars-d mailing list