octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FYI: subasgn argument optimization


From: Robert T. Short
Subject: Re: FYI: subasgn argument optimization
Date: Sat, 15 Aug 2009 19:38:33 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.22) Gecko/20090606 SeaMonkey/1.1.17

Judd Storrs wrote:
Sorry, I found a typo in @foo/access.m. I typed "disp(obj,yy)" instead of "disp(obj.yy)" by accident (comma instead of period).

With this version

@foo/access.m:
function access(obj)
    disp(obj.xx) ;
    disp(obj.yy) ;
end

Then the inherited function uses the parent's values.

>> b = bar() ;
>> access(b)
    10
    20

These are the values from the parent class. It is still true that subclasses cannot access parent class fields and that non-existent fields are not forwarded. Sorry for any confusion.

--judd
The parent class fields may be accessed within a class method or by using subsref/subsasgn, but are private to the class by default.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]