[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Classdef property accessor overriding
From: |
Richard Crozier |
Subject: |
Re: Classdef property accessor overriding |
Date: |
Tue, 21 May 2013 09:07:50 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
On 21/05/2013 03:55, Michael Goffioul wrote:
Could anyone verify for me whether the limitation described in [1] is
still present in current Matlab version?
Michael.
[1] http://www.mathworks.com/matlabcentral/newsreader/view_thread/253167
Using the following in R2012a
classdef BaseClass < handle
properties
Prop
end
methods
function set.Prop(obj,value)
obj.Prop = value;
end
end
end
classdef DerivedClass < BaseClass
methods
function set.Prop(obj,value)
% Do something else
obj.Prop = value * 10;
end
end
end
>> x = BaseClass
x =
BaseClass handle
Properties:
Prop: []
Methods, Events, Superclasses
>> y = DerivedClass
Error using DerivedClass
Error: File: DerivedClass.m Line: 3 Column: 22
Cannot specify a set function for property 'Prop' in class
'DerivedClass', because that property is not defined by
that class.
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.