octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #42735] subclass inheritence: symbol ops (e.g.


From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #42735] subclass inheritence: symbol ops (e.g., plus, mtimes) do not respect superiorto
Date: Thu, 19 Jan 2017 05:10:38 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #5, bug #42735 (project octave):

Ok, I've done some tests with three classdef classes: A and B are unrelated. 
C is a subclass of A.  Attached below.

Here is what Matlab 2015b does:

>> a = A(10); b = B(20); c = C(30);
>> a + b
called A::plus

ans =

    40

>> b + a
called B::plus

ans =

    50

>> c + a
called C::plus

ans =

        1030

>> a + c        %% note
called A::plus

ans =

    50

>> 


Note "a + c" calls the address@hidden  That was unexpected: I suppose that is 
what
"InferiorClasses" is all about.  Will check that next..., stay tuned.

So far, the results from Octave are the same:

octave:1> a = A(10); b = B(20); c = C(30);
octave:2> a + b
called A::plus
ans =  40
octave:3> b + a
called B::plus
ans =  50
octave:4> c + a
called C::plus
ans =  1030
octave:5> a + c
called A::plus
ans =  50
octave:6> 



(file #39506, file #39507, file #39508)
    _______________________________________________________

Additional Item Attachment:

File name: A.m                            Size:0 KB
File name: C.m                            Size:0 KB
File name: B.m                            Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42735>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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