Problem with "delete" and what about "friend" classes & functions?

Johan Granberg lijat.meREM at OVE.gmail.com
Fri Jan 5 15:59:22 PST 2007


John Kiro wrote:

> Hello
> 
> I have a problem with this statement:
> 
>   delete pDoc.getFile();
> 
> It generates this error:
> 
> "Error: ((cast(CDoc)(pDoc)).getFile)() is not an lvalue"

have you tried this "delete (pDoc.getFile());" ?
if I read the error mesage correctly the compiler thinks you want do delete
a function. (I have no compiler nearby so I cant test it)

> Another point, I guess D doesn't support "friend" classes or
> functions.. wouldn't they be useful sometimes?

Probably but I think they can cause trouble too, it comes down to weighting
pros and cons. Something to notice thou is that in D everything in the same
module has full access to all fields, as sort of implicit friend with
everything in the module.


More information about the Digitalmars-d-learn mailing list