override '.' member access

Jonathan M Davis jmdavisProg at gmx.com
Tue Jan 25 11:44:33 PST 2011


On Tuesday, January 25, 2011 11:33:24 spir wrote:
> Hello,
> 
> Cannot find corresponding opSomething method, if any. (opDispatch seems to
> specialise for method call.)
> Else, how to catch obj.member?

You're trying to override a member variable? Or are you trying to override the 
dot operator? You can't override either. You can override member _functions_. 
You can overload a number of operators, but not the dot operator. You can also 
use alias this or opDispatch to call functions that your object doesn't have, 
but you're still dealing with functions. It sounds like you're essentially 
trying to override a member variable, and you can't do that. It's just data. 
There's no function call. There's nothing to override.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list