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

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

[Octave-bug-tracker] [bug #59602] incorrect "not a direct superclass" er


From: Rik
Subject: [Octave-bug-tracker] [bug #59602] incorrect "not a direct superclass" error
Date: Wed, 2 Dec 2020 17:18:48 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

Update of bug #59602 (project octave):

                  Status:                    None => Need Info              
                 Release:                  6.0.90 => 6.1.0                  
        Operating System:                  Mac OS => Any                    

    _______________________________________________________

Follow-up Comment #3:

I'm guessing that this is related to function handles, lazy evaluation, and
having the class constructor for the superclass as a function handle in the
properties section.

As a workaround, can you try declaring property 'a' in the properties block,
but initializing it in the constructor of classA?  This worked for me.

classA.m


classdef classA < classB
    properties
        a
    end
    methods
        function obj = classA()
            disp ("in ClassA() constructor");
            obj@classB();
            obj.a = @classB;
        end
    end
end


classB.m

classdef classB < handle
  methods
    function obj = classB ()
      disp ("in ClassB() constructor");
    end
  end
end


Finally, start a new Octave session and


octave:1> x = classA
in ClassA() constructor
in ClassB() constructor
x =

  classA object with properties:

      a: [1x1 function_handle]

octave:2> x.a
ans = @classB




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59602>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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