Override @property

Aldo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 10 09:40:09 PDT 2017


Hello,

can you tell me if this compilation error is normal ?

class Texture
{
	public this()
	{
		
	}
}

class Control
{
	private Texture m_texture;
	
	@property
	{
		public Texture texture()
		{
			return this.m_texture;
		}
		
		public void texture(Texture value)
		{
			this.m_texture = value;
		}
	}
}

class PictureBox : Control
{
	@property
	public override void texture(Texture value)
	{
		writeln("override");
		this.m_texture = value;
	}
}

import std.stdio;
	
void main()
{
	auto picture = new PictureBox();
	
	writeln(picture.texture is null);
	
}

Error: function f340.PictureBox.texture (Texture value) is not 
callable using argument types ()

Complete code : https://dpaste.dzfl.pl/aa7bf25548e8

I can't use property getter if I override the setter property.




More information about the Digitalmars-d-learn mailing list