How to use the OO features of Octave

David Bateman David.Bateman at motorola.com
Tue Sep 23 08:42:05 CDT 2008


John W. Eaton wrote:
> On 23-Sep-2008, David Bateman wrote:
>
> | Trying to use the OO features of 3.1.51, I fail on a very basic issue. I 
> | have a class directory "@myclass" with the constructor
> | 
> | function b = myclass (a)
> |   b.a = a;
> |   b = class (b, "myclass");
> | endfunction
> | 
> | When called I get error
> | 
> | error: class: invalid call from outside class constructor
> | error: called from:
> | error:   /home/adb014/nobackup/perso/octave/@myclass/myclass.m at line 
> | 3, column 5
> | 
> | what is the issue with the above? Basically, I thought I might try and 
> | do some documentation for the OO could with examples, but am failing 
> | miserably at the moment.
>
> Are you actually using 3.1.51 or a copy of Octave built from hg?
>
> I think this is one of the embarrassing bugs in 3.1.51 that was fixed
> shortly after I made the snapshot.  Your code seems to work with a
> build from last night:
>
>   $ cat @myclass/myclass.m
>   function b = myclass (a)
>     b.a = a;
>     b = class (b, "myclass");
>   endfunction
>   $ octave
>   [...]
>   octave:1> x = myclass (1)
>   octave:2> class (x)
>   ans = myclass
>   

octave:14> ver
----------------------------------------------------------------------
GNU Octave Version 3.1.51+
GNU Octave License: GNU General Public License
Operating System: Linux 2.6.22.19-laptop-2mdv #1 SMP Mon May 5 21:45:32 
EDT 2008 x86_64
----------------------------------------------------------------------

So I'm use the tip as of yesterday. Maybe there is an issue of synchro 
between our repositories.. What was the change that addressed this?

D.



-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



More information about the Octave-maintainers mailing list