Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Using subclass 'get' function to access inherited superclass property
Date: Thu, 12 Nov 2009 20:06:02 +0000 (UTC)
Organization: Xoran Technologies
Lines: 11
Message-ID: <hdhpra$ihm$1@fred.mathworks.com>
References: <hd4h94$g23$1@fred.mathworks.com> <hdhkke$m7a$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1258056362 18998 172.30.248.38 (12 Nov 2009 20:06:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Nov 2009 20:06:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:584680


"Sven" <sven.holcombe@gmail.deleteme.com> wrote in message <hdhkke$m7a$1@fred.mathworks.com>...
> I have the exact same conundrum. If anyone knows an answer (even if that answer is "MATLAB can't do this in the current version"), please post it here.
> 
> When I add a get.supclass_property(this) method to my subclass, MATLAB tells me:
> "Cannot specify a get function for property 'supclass_property' in class 'subclass', because that property is not defined by that class.
> 
> When I go ahead and *add* supclass_property as a property of my subclass, MATLAB tells me:
> "Cannot define property 'supclass_property' in class 'subclass' because the property has already been defined in the super-class 'supclass'.
=====

The idea is you're supposed to be defining get/set methods for properties only in the class that defines that property. If it were possible to add/overload get and set methods in a subclass, it would be possible to set that property in the subclass with a value that is illegal from the point of view of the superclass. Then the superclass' methods would not work anymore.