Shadowing of members

Andrey andr-sar at yandex.ru
Wed Jan 16 04:23:50 PST 2013


> 	class B {
> 		protected int a=123;
> 	}
>
> 	class A : B {
> 		int f(int b) {
> 			//int a;	// <--- I forgot to write this line
> 			...
> 			a = b + 1;	// <---  Oops!
> 			...
> 			return a;
> 		}
> 	}

That's why I don't understand, why D allows to refer to member 
variables and functions without "this". I always use "this" and 
don't have any problems.


More information about the Digitalmars-d mailing list